mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-16 09:56:36 +00:00
Add increment options and slight cleanup
This commit is contained in:
@@ -45,6 +45,7 @@ export interface HandlerResponse {
|
||||
broadcast?: boolean;
|
||||
excludeSender?: boolean;
|
||||
targetClientId?: string;
|
||||
options?: SendMessageOptions;
|
||||
}
|
||||
|
||||
export interface HandlerContext {
|
||||
|
||||
@@ -306,15 +306,21 @@ const setupConnection = async (
|
||||
if (response.broadcast) {
|
||||
await broadcastToAllExcept(
|
||||
response.message,
|
||||
response.excludeSender ? clientId : undefined
|
||||
response.excludeSender ? clientId : undefined,
|
||||
response.options
|
||||
);
|
||||
} else if (response.targetClientId) {
|
||||
await sendToClient(
|
||||
response.targetClientId,
|
||||
response.message
|
||||
response.message,
|
||||
response.options
|
||||
);
|
||||
} else {
|
||||
ws.send(JSON.stringify(response.message));
|
||||
await sendToClient(
|
||||
clientId,
|
||||
response.message,
|
||||
response.options
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user