18 lines
470 B
JavaScript
18 lines
470 B
JavaScript
|
class Client {
|
||
|
constructor() {
|
||
|
this.connected = false;
|
||
|
let uri = 'ws://localhost:8082';
|
||
|
this.client = new WebSocket(uri);
|
||
|
this.client.onopen = this.onOpen.bind(this);
|
||
|
this.client.onmessage = this.onMessage.bind(this);
|
||
|
}
|
||
|
onMessage(event) {
|
||
|
console.log(event.data);
|
||
|
}
|
||
|
onOpen(event) {
|
||
|
console.log('Connected');
|
||
|
this.connected = true;
|
||
|
}
|
||
|
}
|
||
|
new Client();
|
||
|
//# sourceMappingURL=index.js.map
|