diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/src/wsrouter.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/frontend/src/wsrouter.ts b/frontend/src/wsrouter.ts new file mode 100644 index 00000000..8e033f30 --- /dev/null +++ b/frontend/src/wsrouter.ts @@ -0,0 +1,27 @@ +import Logger from './logger'; + +enum MessageType { + CALL, + REPLY, + ERROR, +} + +class WSRouter extends Logger { + routes: Map<string, (args: any) => any> = new Map(); + ws?: WebSocket; + constructor() { + super('WSRouter'); + } + + connect() { + this.ws = new WebSocket('ws://127.0.0.1:1337/ws'); + + this.ws.addEventListener('message', this.onMessage.bind(this)); + this.ws.addEventListener('close', this.onError.bind(this)); + this.ws.addEventListener('message', this.onError.bind(this)); + } + + onMessage() {} + + onError() {} +} |
