socket io error client side

Asked

Viewed 33 times

0

When connecting to the server via socket io the browser returns the following error:

http://localhost:3010/socket.io/?EIO=3&transport=polling&t=NOeqJv8 400 (Bad Request)

The following code has already been added to the server side to accept any kind of infrequent connection from its source:

const io = require("socket.io")(http, {
     cors:{
         origins: '*:*',
         withCredentials:false
        },
        transport : ['websocket']
    });

And in the client side I connect as follows:

 socket = io('ws://localhost:3010/',{
        transport : ['polling'],
        withCredentials:false
    })

I tried so hard with the transport in websocket and polling as well as by default following the socket.io documentation. I’ve read many foruns but no solution to this problem, if anyone can help me, I just need the client to communicate with the server, since the sending part works when the client is run via node

Additional information : Express server port is opened along with the socket.io in this way

const express = require("express")
const app = express()
const port = 3010
const http = require("http").createServer(app)

1 answer

0


This problem occurred due to a version used in the client side, when upgraded to the latest the problem was resolved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.