Error during WebSocket handshake: Unexpected response code: 200
See original GitHub issueI saw similar errors for code 400 and 404, but this one seems strange. After all, I would think a 200 code would mean “everything’s ok” right?
"peer": "^0.5.1",
"peerjs": "^1.2.0"
On server side:
import { ExpressPeerServer } from 'peer'
const PeerController = {}
PeerController.initialize = function (app) {
const peerServer = ExpressPeerServer(app, { debug: true, path: '/peerjs' })
peerServer.on('connection', (client, foo) => {
console.log(client, foo)
})
return peerServer
}
export default PeerController
const app = express()
app.use('/peer', PeerController.initialize(app))
And on the client side (a Vue application):
import Peer from 'peerjs'
export default {
name: 'Meet',
data () {
return {
peer: null
}
},
mounted () {
this.peer = new Peer('12345', {
host: '/',
port: '3000',
path: '/peer/',
debug: 3
})
this.peer.on('error', (err) => {
console.debug(err)
})
this.peer.on('open', function (id) {
console.log(id)
})
}
}
vendor.3921cbfb.js:18 WebSocket connection to 'ws://localhost:3000/peer/peerjs?key=peerjs&id=12345&token=697lo3pxz52' failed: Error during WebSocket handshake: Unexpected response code: 200
I noticed that it was 404ing initially until I added the path: '/peerjs' in the ExpressPeerServer constructor, because it seems that no matter what the client library tries to hit that endpoint. Not a huge worry, but after I solved the 404 issue I now get an “error” with a 200 code. Any advice? Thank you very much…
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
java - WebSocket Handshake - Unexpected response code 200
withSockJS(); but unexpected error 200 was occuring. I've fixed this by appending /websocket to my client request string on the chrome ...
Read more >wss: Error during WebSocket handshake: Unexpected ...
The strange thing is that you get a 200 status code. It seems that you are not hitting the WebSocket server as it...
Read more >Error during WebSocket handshake: Unexpected response code
I have submitted a ticket (228750) already but not getting very prompt responses.
Read more >Error during WebSocket handshake: Unexpected response code
I'm hitting some strange issues with this plugin currently on a client's website when trying to access the WP Live Chat Menu page....
Read more >Websocket not proxied, client receives response code 200
In your Node.JS app, have you specified the usage of wss URLs? Make sure at Cloudflare dashboard → Network → WebSockets the option...
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

@baggachipz Anyway, join to our telegram chat) https://t.me/joinchat/ENhPuhTvhm8WlIxTjQf7Og
Looks like using the look-ahead regex worked. Might be handy to also allow passing in app instead of server, so that this is easier to handle. But thank you for your assistance!