interface PendingChatMessage

Shows a chat message the moment the user sends it, and lets them retry it if it fails. WSProvider holds it until the server echoes the message back, and ChatModal shows it, as PendingItem, after the messages the server has.

Properties

nonce: string

Sent with chat_send and returned with the echo or the error. A retry gets a new one, so a late echo of the first attempt can't retire it.

body: string

When this client sent it, to find it in the history after a reconnect.

status: "sending" | "failed"

failed when the server refused it, the socket was down or closed, or no echo came in 10 s. A failed message may still have reached the server.

optional
error: string

Usage

import { type PendingChatMessage } from "src/contexts/ws/WSContext.ts";