question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Socket.io can't connect to WebSockets (only)

See original GitHub issue

You want to:

  • report a bug
  • request a feature

Current behaviour

I connect to a WebSocket using Socket.io and no connection will be established. The WebSocket server (PHP Ratchet) detects a connection but this will be closed soon and Socket.IO never says that the client is connected to the server.

Steps to reproduce (if the current behaviour is a bug)

var conn = io('wss://demos.kaazing.com/echo', { upgrade: false, transports: ['websocket'] });

Error: Error during WebSocket handshake: Unexpected response code: 403

This is working:

var conn = new WebSocket('wss://demos.kaazing.com/echo');

-> Tested in the console of https://socket.io/get-started/chat/ <-

Expected behaviour

That socket.io can handle the WebSocket 👍

Setup

  • OS: Windows 10
  • browser: Google Chrome 66.0.3359.181 (Official Build) (64-bit)
  • socket.io version: 1.3.5 and 2.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
patrickbussmanncommented, Jul 4, 2018

Hi @hongweipeng, Im using new WebSocket() direct instead of using Socket.IO client.

2reactions
hongweipengcommented, Jul 4, 2018

@patrickbussmann Well,Im also going to use the same way as you, thx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting connection issues | Socket.IO
You are trying to reach a plain WebSocket server; The server is not reachable; The client is not compatible with the version of...
Read more >
WebSocket not connecting to socket.io - Stack Overflow
You need a socket.io client to pass some authentication phases I believe. Try this, and it should work(the client javascript is served by ......
Read more >
Can not connect to socket.io with websocket - Microsoft Q&A
Hi,. This is my Azure NodeJS AppService's socket.io setup. Client side: const socket = io('https://testappsocket.azurewebsites.net', ...
Read more >
Socket.IO vs. WebSocket: A comparison - Ably Realtime
IO officially only provided a Node.js server implementation, ... IO client will not be able to connect to a plain WebSocket server either....
Read more >
Differences between WebSockets and Socket.IO - ITNEXT
You have 2 free member-only stories left this month. ... If (for some reason) a WebSocket connection drops, it will not automatically ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found