Skip to content

Instantly share code, notes, and snippets.

@rbraeunlich
Created September 18, 2016 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbraeunlich/eded91382d72a3d90e8182ca1b077d01 to your computer and use it in GitHub Desktop.
Save rbraeunlich/eded91382d72a3d90e8182ca1b077d01 to your computer and use it in GitHub Desktop.
The JavaScript code for the client
var connection = new WebSocket('ws://localhost:8080/greeter');
connection.onopen = function(){
connection.send('connect');
}
connection.onerror = function (error) {
console.log('WebSocket Error ' + error);
};
connection.onmessage = function(e){
console.log('Server: ' + e.data);
}
function send(){
connection.send('text');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment