Answer the question
In order to leave comments, you need to log in
Why is it not connecting to webSocket?
I connect from a browser from any page to wss://cs.money/ws and everything is fine, but as soon as I try with nodejs, nothing works
'use strict'
var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();
// Вешаем на него обработчик события подключения к серверу
client.on('connect', handler);
// Подключаемся к нужному ресурсу
client.connect('wss://cs.money/ws');
function handler(connection) {
connection.on('message', function (message) {
console.log(message);
})
connection.send('ping');
}
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