fix(types,client,server): improve type safety and harden client/server message handling
This commit is contained in:
@@ -15,6 +15,12 @@ export interface ISocketRequest_ProcessMessage {
|
||||
method: 'processMessage';
|
||||
request: interfaces.IUniverseMessage;
|
||||
response: {
|
||||
messageStatus: 'ok' | 'channel not found';
|
||||
messageStatus: 'ok' | 'channel not found' | 'authentication required';
|
||||
};
|
||||
}
|
||||
|
||||
export interface ISocketRequest_Unsubscribe {
|
||||
method: 'unsubscribe';
|
||||
request: interfaces.IServerUnsubscribeActionPayload;
|
||||
response: {};
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
export interface IMessageCreator {
|
||||
export interface IMessageCreator<T = any> {
|
||||
messageText: string;
|
||||
payload?: string | number | any;
|
||||
payload?: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* A universe
|
||||
*/
|
||||
export interface IUniverseMessage extends IMessageCreator {
|
||||
export interface IUniverseMessage<T = any> extends IMessageCreator<T> {
|
||||
id: string;
|
||||
/**
|
||||
* time of creation
|
||||
|
||||
Reference in New Issue
Block a user