feat(chat): send idempotent client message ids
Docker Image / Build and Push Docker Image (push) Successful in 2m18s
Docker Image / Build and Push Docker Image (push) Successful in 2m18s
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
type ChatAction,
|
||||
type CommercialAction,
|
||||
} from "@/data/schemas/chat";
|
||||
import { createClientMessageId } from "@/lib/chat/client_message_id";
|
||||
|
||||
const log = new Logger("ChatWebSocket");
|
||||
const RECONNECT_DELAY_MS = 3000;
|
||||
@@ -101,8 +102,11 @@ export class ChatWebSocket {
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(content: string): boolean {
|
||||
const payload = { type: "message", content };
|
||||
sendMessage(
|
||||
content: string,
|
||||
clientMessageId: string = createClientMessageId(),
|
||||
): boolean {
|
||||
const payload = { type: "message", content, clientMessageId };
|
||||
if (!this.isConnected) {
|
||||
logWebSocketWarn("→ WS SEND SKIPPED: socket is not open", payload);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user