Y
Y
ymenaidtopa2021-12-17 23:25:48
Node.js
ymenaidtopa, 2021-12-17 23:25:48

Socket.io can't connect to server?

When connecting to the server, it gives the following error:

websocket.js:203 WebSocket connection to 'wss://danger-nvuti.space:10888/socket.io/?uid=600821208&nick=%D0%9D%D0%B8%D0%BA%D0%B8%D1%82%D0%B0%20%D0%9C%D0%BE%D1%80%D0%BE%D0%B7%D0%BE%D0%B2&photo=https%3A%2F%2Fsun1-55.userapi.com%2Fs%2Fv1%2Fig2%2Fs6od3m4ih0fh7FeejERtty4W5WqqeF8xlO0YVg6vAAD-lUFtL7W8hO9Yf9TNqn-S5hjajLEGJ5K2pddZED73gh5H.jpg%3Fsize%3D200x200%26quality%3D95%26crop%3D367%2C1%2C719%2C719%26ava%3D1&params=vk_access_token_settings%3D%26vk_app_id%3D8029341%26vk_are_notifications_enabled%3D0%26vk_is_app_user%3D1%26vk_is_favorite%3D0%26vk_language%3Dru%26vk_platform%3Ddesktop_web%26vk_ref%3Dother%26vk_ts%3D1639772449%26vk_user_id%3D600821208%26sign%3DXiudctoycMx2k0umiTUxWIderdI60846KQtxuz3VjRM&nowcode=&EIO=4&transport=websocket' failed: WebSocket is closed before the connection is established.

Connection code:
io.on('connection', async function (socket) {
        let params = socket.handshake.query.params
        let vars = socket.handshake.query
        let prov = validateAppUrl(params, "6Uc75GjlyLtxZzDgXHc8");
        if (!prov.status) return console.log(`err1`) && socket.disconnect()
        params = getUrlVars(params)
        if (Number(params.vk_user_id) != Number(socket.handshake.query.uid)) {
          console.log(`err`)
            return  socket.disconnect()

        }

        console.log(`ok`)

// Остальной код

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question