Cannot connect to WebSocket

805 views
Skip to first unread message

agnotif...@gmail.com

unread,
Feb 27, 2018, 3:26:48 AM2/27/18
to discuss-webrtc
I'm trying to teach myself WebRTC and have been stuck for a long while on this error (using Chrome):

WebSocket connection to 'wss://URLblahblah/' failed: Error during WebSocket handshake: Unexpected response code: 200

I've read that the reason for this is that the WebSocket connection isn't getting established and that the return code for a successful connection is 101, but have not been able to find out what I need to change/fix to get the 101 return code instead of the 200.

It's on this line of code that the attempt to connect always fails:

var connection = new WebSocket('wss://URLblahblah:443/');

I'm guessing that I have something mis-configured but I don't what it is.  I deployed the test app to a Windows 2012 server, and I did add WebSocket capability to its IIS configuration.  Does it have something to do with setting the subprotocol (the 2nd optional parameter)?  If so what are the values I can use for that parameter when instantiating WebSocket?


Sergio Garcia Murillo

unread,
Feb 27, 2018, 4:22:13 AM2/27/18
to discuss...@googlegroups.com
If you are getting a 200OK, the server is not doing the upgrade correctly. Anyway, not sure if this forum is the best place to get a response for a generic IIS websocket configuration problem.

Best regards
Sergio
--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/6b73a8ff-23ac-4fb0-a5ea-f6e0e9eed6d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


agnotif...@gmail.com

unread,
Mar 1, 2018, 4:20:51 PM3/1/18
to discuss-webrtc
Contextually it's part of how I'm trying to get WebRTC working as a novice with the technology since part of the requirement for WebRTC is to have WebSockets working, so it's surprising that no one else working with WebRTC would have run into something like this and have learned how to fix it so that WebRTC will provide its expected behavior.

Iñaki Baz Castillo

unread,
Mar 1, 2018, 4:31:35 PM3/1/18
to discuss...@googlegroups.com
On 1 March 2018 at 22:20, <agnotif...@gmail.com> wrote:
> Contextually it's part of how I'm trying to get WebRTC working as a novice
> with the technology since part of the requirement for WebRTC is to have
> WebSockets working, so it's surprising that no one else working with WebRTC
> would have run into something like this and have learned how to fix it so
> that WebRTC will provide its expected behavior.

You may also have problems building an REST API, or a database, or
frontend, or oauth stuff, or whatever. And probably many of them are
also components of a full "WebRTC app", but that's not an excuse to
ask here questions about REST APIs or databases.

--
Iñaki Baz Castillo
<i...@aliax.net>

Iñaki Baz Castillo

unread,
Mar 1, 2018, 4:40:50 PM3/1/18
to discuss...@googlegroups.com
> On 1 March 2018 at 22:20, <agnotif...@gmail.com> wrote:
>> since part of the requirement for WebRTC is to have WebSockets working

And BTW, that's not true.

Eric Davies

unread,
Mar 2, 2018, 12:28:38 PM3/2/18
to discuss-webrtc
it probably depends on how your websockets are configured on he server, but we use something more like this,
   var connection = new WebSocket('wss://URLblahblah:443/ws');
easy to try at least.
Reply all
Reply to author
Forward
0 new messages