ambelovsky / koa-socket-2

Socket.IO for Koa
https://www.npmjs.com/package/koa-socket-2
98 stars 14 forks source link

Disallowed URL Scheme #4

Closed thealexbaron closed 7 years ago

thealexbaron commented 7 years ago

First, thank you for picking up koa-socket!

I'm seeing the error in the screenshot below after upgrading to your fork. Any tips on how to resolve this issue? disallowed url scheme

The error in my dev tools looks like this: WebSocket connection to 'wss://[site].com/socket.io/?EIO=3&transport=websocket&sid=QuhroCUoDOeE7rf2AABO' failed: Connection closed before receiving a handshake response

Any tips?

ambelovsky commented 7 years ago

Hey Alexander,

Happy to do it. :-)

I'm actually seeing two different protocols in each of your two examples. The error in your dev tools appears to be connecting using "wss:" (web socket secure) protocol, but the screenshot is showing an issue with "ws:" (unsecure) protocol.

Are you able to provide any code samples related to how you are starting your server? I think that would give me a better idea of what's going on.

If using secure protocol, check to be sure your certs are valid and registered to the FQDN for your site with a valid CA. You might also downgrade your server to "ws:" temporarily just to see if you can establish any connection at all.

Make sure you've upgraded to the latest version of the socket.io-client as well.

Hopefully this helps -- let me know if you're able to provide code samples.

ambelovsky commented 7 years ago

Alexander,

Know too that you won't be able to access a websocket URL just by placing the link into your browser. You'll have to use a valid socket.io client to access the URL. That initial screenshot seems to show the URL being placed directly in your browser.