Created
July 24, 2016 09:15
-
-
Save victoryforphil/e7629ec57fb5ba5a9dfb9c909e321efe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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