becvert/cordova-plugin-websocket-server

wss:// support

elewin opened this issue · 6 comments

Does this plugin support WebSocket Secure? If so, how would one enable it? I see there's a protocols property on the configuration object, but I'm not sure what to add there to add wss (if thats even where it would be added)

Thanks

It does not.

The underlying libraries (PocketSocket and TooTallNate) do support SSL/TLS though.
So implementing the secure feature is feasible, but I think there is a problem with the certificates:
one would need a self-signed certificate as a certificate delivered by a trusted authority could not be used. I believe.

I had already tried to add the secure feature but without success.
So any help would be appreciated.

By curiosity, could you provide details of the context in which you would need wss://? thanks

The protocols option is about Sec-WebSocket-Protocol

Thanks for the reply. I am thinking of developing a kiosk app for tablets that would accept payment information on one tablet and send it to another, and figure it might be a good idea to do it over wss. Worst case scenario I can look into other encryption options.

Supporting SSL-secured Websocket server connections on a device would require you to distribute your private key along with the public certificate, which in most case wouldn't be a good idea...

There are some use cases, where you may have a need to access a local process, and due to the policy on browsers to avoid "mixed-content" ( see google about it ), it is a good idea to have TLS support, even if you don;t exchange sensitive data, just to obey browsers rules about rules about mixed-content.

Adding a key to your device is no different that adding to a box acting as a server. In this case here, your device is the server.

bcjat commented

Any update? I'm running server with IONIC 4, and want to connect also from ionic app. So ionic uses chrome webview under the hood. Chrome does not allow to connect "ws://" and throw error: connection refused. So it is needed that this support wss.

qpwr commented

I ran into a use case where I'd like to communicate from a website to my app which runs the websocket server. This would only work if the website didn't use https, because otherwise it would be mixed content. The issue here is that I need to use getUserMedia on the website, which is only allowed in secure contexts.

Is there any chance you are still evaluating this, @becvert?