Resclient - Secure WebSockets

Are there any plans to provide an option in Resclient to use Secure WebSockets (wss://) instead of regular Websockets (ws://)?

Lucky enough, ResClient already supports secure WebSockets.

In the Live Demos, you can see that it connects with wss://

// Creating a client instance.
let client = new ResClient('wss://api.resgate.io');

But Resgate doesn’t run TLS (a.k.a. doesn’t allow wss connections) by default. You must enable TLS and provide the key and certificate file for encryption to work. See Configuration • resgate.io for more info.

Another way is to let a reverse proxy, like Nginx, handle the TLS encryption. That is actually what is done for api.resgate.io.
You can find more info on how to configure Resgate with Nginx here: Nginx reverse proxy

Hope that helps!

Best regards,
Samuel

Given my current knowledge, nginx seems like overkill for now, so I opted to just use a localhost key and cert to get wss://127.0.0.1:8080 up and running. Thanks for the advice!

1 Like