mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-09-20 14:18:47 +00:00
Create new helper method
This commit is contained in:
@@ -22,6 +22,21 @@ export class WsMessage implements WsMessageBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct quickly a message with no ID (to propagate
|
||||
* events to clients)
|
||||
*
|
||||
* @param title The title of message
|
||||
* @param data Data associated with the message
|
||||
*/
|
||||
public static NoIDMessage(title: string, data: any) : WsMessage {
|
||||
return new this({
|
||||
id: "",
|
||||
title: title,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
get isValidRequest() : boolean {
|
||||
return typeof this.id === "string"
|
||||
&& typeof this.title === "string"
|
||||
|
Reference in New Issue
Block a user