From 18d89e76fd1f90066fbad08000c71ba149d2a4aa Mon Sep 17 00:00:00 2001 From: AAGaming Date: Thu, 6 Apr 2023 12:51:13 -0400 Subject: more work on websockets --- frontend/src/wsrouter.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 frontend/src/wsrouter.ts (limited to 'frontend/src/wsrouter.ts') 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 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() {} +} -- cgit v1.2.3