web: live chat transcript over chat_event (C5)
This commit is contained in:
@@ -197,6 +197,26 @@ export class PipelinesRepository {
|
||||
return { messages: response[ChatKeys.MESSAGES] ?? [], nextCursor: "", hasMore: false };
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches this connection to one session's shared live stream (C5). The body
|
||||
* is exactly `{type:'chat_subscribe', chat_subscribe:{session_id}}` — the
|
||||
* `chat_subscribe` field, not `chat_query` (internal/protocol/message.go); the
|
||||
* server replies with an id-matched echo once the subscription is attached and
|
||||
* then pushes `chat_event` frames without an id, which `client.js` surfaces as a
|
||||
* `frame` event. Any number of clients may watch one session; the session is
|
||||
* never read-only. There is no `chat_unsubscribe`: the server drops a
|
||||
* subscription when the connection closes.
|
||||
*/
|
||||
async subscribeChat(sessionId) {
|
||||
if (!String(sessionId ?? "").trim()) {
|
||||
throw new ProtocolError("Select a chat session first.");
|
||||
}
|
||||
return this.#client.call({
|
||||
type: Protocol.CHAT_SUBSCRIBE,
|
||||
[ChatKeys.SUBSCRIBE]: { session_id: sessionId },
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes a session and records it closed on the server (nothing is
|
||||
* deleted). The reply echoes the updated session (`chat_session`) and the
|
||||
|
||||
Reference in New Issue
Block a user