5,321
edits
No edit summary |
No edit summary |
||
Line 66: | Line 66: | ||
==Compilation== | ==Compilation== | ||
===Webpack=== | |||
===Babel=== | |||
==Websockets== | |||
How to use Websockets | |||
===Getting Started=== | |||
<syntaxhighlight lang="javascript"> | |||
let ws = new WebSocket(this.SERVER_URL); | |||
ws.onopen = function(event) { | |||
console.log("Websocket opened"); | |||
ws.send("Hi"); | |||
}; | |||
ws.onmessage = function(event) { | |||
console.log("message received"); | |||
console.log(event.data); | |||
}; | |||
ws.onclose = function() { | |||
console.log("WS Closed"); | |||
}; | |||
</syntaxhighlight> | |||
==Modules== | ==Modules== |