Error: unexpected server response (404)
See original GitHub issueI am trying to connect to PubNub using a websocket, just like the example here but with node: https://www.pubnub.com/websockets/
The example code works fine in the browser, but using ws
I get:
Error: unexpected server response (404)
at ClientRequest.response (/Users/dennybritz/node_modules/ws/lib/WebSocket.js:719:15)
at Object.onceWrapper (events.js:316:30)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
at TLSSocket.socketOnData (_http_client.js:454:20)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
Any idea what could be going wrong here? Any workaround?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
WebSocket handshake: Unexpected response code: 404
Am writing my first websocket program and am getting "WebSocket handshake: Unexpected response code: 404", error while loading the webpage.
Read more >404 Not Found Error: What It Is and How to Fix It
The 404 Not Found Error is an HTTP response status code, which indicates that the requested resource could not be found. Like most...
Read more >Error during WebSocket handshake: Unexpected response code
when I put old server url, the url was working, But when I put new server url, the url appeared as "404" with...
Read more >Help with Error during WebSocket handshake: Unexpected ...
Help with Error during WebSocket handshake: Unexpected response code: 404 ... I can't seem to get by this, would anyone have any guidance?...
Read more >The server responded with a status code of 404 (UniFi ...
Unexpected Error : The server responded with a status code of 404 (UniFi Video 3.2.2) ... We've run across a problem with 3.2.2....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@paulddrix see https://github.com/websockets/ws/blob/84fa837dc074baef3d4f81d33120602b58a6c133/test/websocket.test.js#L513-L526
Yes that’s correct because for an upgrade request, you should receive an upgrade response.
https://github.com/websockets/ws/blob/84fa837dc074baef3d4f81d33120602b58a6c133/lib/websocket-server.js#L257-L262