niv / websocket.nim

websockets for nim
http://niv.github.io/websocket.nim/docs/0.1.1/websocket.html
Other
102 stars 25 forks source link

Can't connect to secure websocket #70

Closed jfilby closed 2 years ago

jfilby commented 2 years ago

This is via the wss:// protocol.

The error is:

Async traceback:
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncdispatch.nim(1961)               waitFor
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncdispatch.nim(1653)               poll
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncdispatch.nim(419)                runOnce
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncdispatch.nim(234)                processPendingCallbacks
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncmacro.nim(28)                    sendNimAsyncContinue
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncnet.nim(271)                     sendIter
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\asyncnet.nim(221)                     getSslError
  C:\Users\jason\.choosenim\toolchains\nim-1.6.6\lib\pure\net.nim(548)                          raiseSSLError
..
Exception message: error:141A90B5:SSL routines:ssl_cipher_list_to_bytes:no ciphers available
metagn commented 2 years ago

Hi, can you try other configurations for the context parameter in newAsyncWebsocketClient? By default it's newContext(protTLSv1, CVerifyNone), you may replace protTLSv1 with protSSLv23, or CVerifyNone with CVerifyPeer (though I doubt this would help).

jfilby commented 2 years ago

Thanks! Using newContext() with protSSLv23 worked.

dom96 commented 2 years ago

Nice! Props for the quick fix @metagn

jfilby commented 2 years ago

Nice! Props for the quick fix @metagn

Yes, in fact that hint was so helpful I think it should be in the docs.