Last active
May 4, 2016 15:36
-
-
Save sethdorris/b6164a64ae18a7f13c1cbcca1bc39911 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
let ws = new WebSocket("ws://localhost:3000"); | |
const server = { | |
connected: false, | |
connect: function() { | |
console.log("Connected", this.connected); | |
ws.onopen = () => { | |
console.log("CONNECTED!"); | |
} | |
ws.onerror = (e) => { | |
console.log("Error", e); | |
} | |
return this.connected; | |
}, | |
sendmessage: () => { | |
ws.send(JSON.stringify({message: "hi"})); | |
} | |
} | |
export default server; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment