Created
January 22, 2017 08:20
-
-
Save JanneSalokoski/a9897c78b271cf3e19c737671c6d5b44 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 URL = "http://localhost:8080/"; | |
var Socket = function(url) | |
{ | |
// Global properties | |
this.url = url; | |
this.connection = new WebSocket(URL); | |
// Global functions | |
this.send = function(msg) | |
{ | |
this.connection.send(msg); | |
} | |
// Private functions | |
this.connection.onmessage = function (event) | |
{ | |
console.log(event.data); | |
} | |
} | |
var socket = new WebSocket(URL); | |
socket.send("uik"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment