Right now I am setting the nodejs server to use webscoket to receive the data from other server
I have tried to use websocket(ws) in nodejs server, and it can connect to the other server
const WebSocket = require('ws');
var ws = new WebSocketClient();
ws.open("ws://ws.something/?token="+Token);
But when I try to connect using socket.io, the console does not display a debug message, and no data is received
var io = require('socket.io-client')
const socket = io.connect('ws://ws.something/?token='+Token);
socket.on("connection", function(mSocket){
console.log('debug message')
mSocket.on("message", function(myData){
console.log(myData)
});
});
socket.on('error', function (err) {
console.log(err);
});
Can socket.io connect to ws:// ? Or is there something wrong with my code? (This is the first time to use it)