mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-14 23:33:38 +00:00
19 lines
478 B
JavaScript
19 lines
478 B
JavaScript
var http = require('http');
|
|
|
|
console.log('starting client test');
|
|
console.log('Sending Request');
|
|
var req = http.request({host: '127.0.0.1', port: 9093, protocol: 'ws:'});
|
|
|
|
|
|
req.on('upgrade', function (res, sk, h)
|
|
{
|
|
sk.on('ping', function () { console.log('received ping'); });
|
|
sk.on('pong', function () { console.log('received pong'); });
|
|
this.websocket = sk;
|
|
|
|
console.log("Upgraded to WebSocket!"); sk.write(JSON.stringify({ a: 'hello' }));
|
|
});
|
|
//req.end();
|
|
|
|
|