nats.net
nats.net copied to clipboard
Websocket Support
Websocket Support
Add an option to allow the NATS client to use the websockets client rather than a standard TCP Client. This will likely involve refactoring and a different read loop.
https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocket?view=netcore-3.1
See #383
This would be a nice addition for nat.net due to the TLS quirks discussed in https://github.com/nats-io/nats-server/issues/291
This would be a nice addition for nat.net due to the TLS quirks discussed in nats-io/nats-server#291
Couldn't agree more. Websockets would be the perfect solution to fix the TLS quirks and to allow connection to a NATS server in the cloud via the most restrictive firewalls.
Seems this would be a fairly well encapsulated task. TCPConnection class could be enhanced or a WebsocketConnection class could be added with reasonable effort.
@scottf What is the LoE for WebSockets support in the .NET client?
I would like to poke the status on this, It is currently making dealing with TLS some what of a pain due to the aforementioned inability to use a proper TLS reverse proxy. This feature would solve/help alleviate that substantially!
This issue was closed as completed but I cannot find any code referring to websocket in the code. Can someone please clarify? @scottf Is this supported or "not yet"?
@ptrubini The completed comment was added by github, not me.
It looks like new client library (https://github.com/nats-io/nats.net.v2) supports websocket. If you can use .net 6 or newer you can switch to new library.