feat: a framework of active (reverse, 反向) websocket

This commit is contained in:
Wesley F. Young
2024-08-10 15:12:17 +08:00
parent 509b123064
commit 340e94d54e
2 changed files with 76 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
}
wsClient.on('message', (message) => {
// TODO: extract action name and payload from the message, then call the corresponding action.
// TODO: consider using a utility function
});
wsClient.once('close', () => {
this.wsClientsMutex.runExclusive(async () => {
@@ -53,6 +54,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter {
this.wsClients.forEach((wsClient) => {
// wsClient.send(JSON.stringify(event));
// TODO: wrap the event, and send the wrapped to the client.
// TODO: consider using a utility function
});
});
}