Skip to content

Add IStreamClientConfig.OptimisticMessageInsert to opt out of optimistic local message insertion#212

Open
harlan wants to merge 1 commit into
GetStream:developfrom
harlan:feature/optimistic-message-insert-config
Open

Add IStreamClientConfig.OptimisticMessageInsert to opt out of optimistic local message insertion#212
harlan wants to merge 1 commit into
GetStream:developfrom
harlan:feature/optimistic-message-insert-config

Conversation

@harlan

@harlan harlan commented Jun 17, 2026

Copy link
Copy Markdown

By default a sent message is inserted into the local channel state and raised via IStreamChannel.MessageReceived immediately, before the server's message.new WebSocket echo arrives (the echo is then de-duplicated). Some apps need every participant - including the sender - to observe messages in a single server-defined order, where instant local feedback is undesirable.

Add OptimisticMessageInsert (default true; no behavior change). When false, SendNewMessageAsync skips the optimistic local insert and only updates the message cache, letting the server's message.new echo deliver the sender's own message so it arrives in the same order for all participants. Thread ReplyCount accounting and the WebSocket receive/dedup path are unchanged.

Client-level config to match the existing LogLevel pattern and keep the change minimal.

…tic local message insertion

By default a sent message is inserted into the local channel state and raised via
IStreamChannel.MessageReceived immediately, before the server's message.new WebSocket
echo arrives (the echo is then de-duplicated). Some apps need every participant -
including the sender - to observe messages in a single server-defined order, where
instant local feedback is undesirable.

Add OptimisticMessageInsert (default true; no behavior change). When false,
SendNewMessageAsync skips the optimistic local insert and only updates the message
cache, letting the server's message.new echo deliver the sender's own message so it
arrives in the same order for all participants. Thread ReplyCount accounting and the
WebSocket receive/dedup path are unchanged.

Client-level config to match the existing LogLevel pattern and keep the change minimal.

Signed-off-by: Harlan Crystal <harlan@pocketgems.com>
@harlan

harlan commented Jun 19, 2026

Copy link
Copy Markdown
Author

@sierpinskid Looks like CI failed, but it's a bunch of errors talking about unity licenses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant