Answer the question
In order to leave comments, you need to log in
Error connecting to websocket (socket.io), how to connect?
Hello, I wrote a small service on a node using sockets, when I wrote for the test I used postman and everything works fine,
But when I started connecting from in the browser, I started getting an error
websocket.js:89 WebSocket connection to 'wss://myurl.com:3000/socket.io/?EIO=4&transport=websocket&sid=KnZ01Z8nT9vnHCpyAANf' failed:
{
secure: true,
rejectUnauthorized: false
}
{
secure: true,
transports: ['websocket'],
withCredentials: true,
rejectUnauthorized: false
}
require('socket.io')(server, {
cors: {
origin: '*',
methods: ["GET", "POST"]
}
io.sockets
.on('connection', (socket) => {
try {
console.log('connection');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question