Skip to content

Instantly share code, notes, and snippets.

@victoryforphil
Created July 24, 2016 09:15
Show Gist options
  • Save victoryforphil/e7629ec57fb5ba5a9dfb9c909e321efe to your computer and use it in GitHub Desktop.
Save victoryforphil/e7629ec57fb5ba5a9dfb9c909e321efe to your computer and use it in GitHub Desktop.
var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();
client.on('connectFailed', function(error) {
console.log('Connect Error: ' + error.toString());
});
client.on('connect', function(connection) {
console.log('WebSocket Client Connected');
connection.on('error', function(error) {
console.log("Connection Error: " + error.toString());
});
connection.on('close', function() {
console.log('Connection Closed');
});
connection.on('message', function(message) {
console.log(message);
console.log("MSG");
});
var command = {"authenticate":"xxx"};
var sayCommad = { "command" : "!mods"};
connection.send(JSON.stringify(command) );
connection.send(JSON.stringify(sayCommad) );
});
client.connect('ws://seaotters.club:25004');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment