Message types and server2 (#46)

* fixed building issue

* fixed building issue
This commit is contained in:
Valentin Heiserer
2024-04-23 22:09:22 +02:00
committed by GitHub
parent a0a1cfaa4a
commit 2cd8359518
4 changed files with 196 additions and 187 deletions

View File

@@ -1,21 +1,13 @@
import {MessageType} from "../BackendMessage.ts";
interface JsonMessage {
origin: string;
message: any; // Adjust 'any' type as per your expected message structure
}
export class BackendConnection {
private readonly webSocket: WebSocket;
private messageListeners: ((message: string) => void)[] = [];
private backendUri: string;
constructor(backendUri: string) {
this.backendUri = backendUri;
this.webSocket = new WebSocket(backendUri);
// Registering event listener for message reception