Created
September 18, 2016 13:52
-
-
Save rbraeunlich/eded91382d72a3d90e8182ca1b077d01 to your computer and use it in GitHub Desktop.
The JavaScript code for the client
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 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