WebDevSimplified / Zoom-Clone-With-WebRTC

1.52k stars 865 forks source link

Error during WebSocket handshake: Unexpected response code: 400 #44

Open vol-and opened 3 years ago

vol-and commented 3 years ago

Can someone clarify why I get this error on a remote server?

socket.io.js:4304 WebSocket connection to 'wss://testserver.dev/socket.io/?EIO=4&transport=websocket&sid=dwA8loUIYHYCG7DTAAAA' failed: Error during WebSocket handshake: Unexpected response code: 400

The code is on Plesk server with some minor changes deployed.

such as: server.js

const express = require('express'); const app = express(); const server = require('http').Server(app); const io = require('socket.io')(server, { pingInterval: 30000, pingTimeout: 20000, secure: true, cookie: 'smfio' });

script.js

let socket = io({ reconnection: false, 'forceNew': true });

I can see myself though. The other users which are to the same room connected see also only themself, but I can see in console that they are connected. What is the cause of this?

socket.on('user-connected', userId => { loggedUserCount++ console.log('connected: ' + userId) })