1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-09-20 06:08:46 +00:00

Turn WsMessage into an object

This commit is contained in:
2020-03-31 14:53:46 +02:00
parent d4b624e519
commit 348084442b
3 changed files with 32 additions and 12 deletions

View File

@@ -5,7 +5,8 @@
*/
import { BaseRequestsHandler } from "./BaseRequestsHandler";
import { ActiveClient, WsMessage } from "../controllers/UserWebSocketController";
import { ActiveClient } from "../controllers/UserWebSocketController";
import { WsMessage } from "./WsMessage";
export class UserWebSocketRequestsHandler extends BaseRequestsHandler {
@@ -17,7 +18,7 @@ export class UserWebSocketRequestsHandler extends BaseRequestsHandler {
return this.wsClient.userID;
}
protected getPostParam(name: string) {
throw new Error("Method not implemented.");
}

24
src/entities/WsMessage.ts Normal file
View File

@@ -0,0 +1,24 @@
/**
* WebSocket message
*
* @author Pierre Hubert
*/
export interface WsMessageBuilder {
id: string,
title: string,
data: any
}
export class WsMessage implements WsMessageBuilder {
id: string;
title: string;
data: any;
public constructor(info: WsMessageBuilder) {
for (const key in info) {
if (info.hasOwnProperty(key))
this[key] = info[key];
}
}
}