add message rendering, fix sse cancling, add user id copying
This commit is contained in:
parent
f1539bdffa
commit
3a0f096ade
6 changed files with 155 additions and 42 deletions
|
|
@ -66,6 +66,16 @@ export async function GET({ locals, request }) {
|
|||
kvStore.set(`user-${userId}-state`, Status.OFFLINE);
|
||||
_sendToSubscribers(userId, { type: 'status', id: userId, status: Status.OFFLINE });
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
console.log(`SSE Client cancelled. total: ${_clients.size}`);
|
||||
|
||||
if (_isUserConnected(userId)) return;
|
||||
|
||||
if (overwrite === Status.OFFLINE) return;
|
||||
|
||||
kvStore.set(`user-${userId}-state`, Status.OFFLINE);
|
||||
_sendToSubscribers(userId, { type: 'status', id: userId, status: Status.OFFLINE });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue