mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-15 18:13:40 +03:00
more work on websockets
This commit is contained in:
27
frontend/src/wsrouter.ts
Normal file
27
frontend/src/wsrouter.ts
Normal file
@@ -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() {}
|
||||
}
|
||||
Reference in New Issue
Block a user