function close()
?const WebSocket = require('ws');
const ws = new WebSocket('ws://serveradress.com', {
});
ws.on('open', function open() {
console.log('connected');
ws.send('sendmessage');
});
ws.on('close', function close() {
console.log('disconnected');
});
ws.on('message', function incoming(data) {
console.log(data);
});