Application patterns

Optimistic updates

An optimistic update changes the interface before the server confirms an action, making the application feel responsive while it waits for the authoritative result.

Also found under: Optimistic UI, Echo suppression

How it works

The UI must reconcile success, validation errors and network failures. A later realtime event may describe an action already shown locally, so use stable IDs or reconciliation rules to avoid duplicates. Skipping the sender's echo alone does not confirm that the action succeeded.

In a Pubb integration

Pubb's optional socket_id publication field can exclude the initiating connection. Your application still owns saving the action, handling errors and synchronizing other tabs or devices.

Publish an event

A practical example

Show a pending chat message immediately, send it to your backend, and replace its temporary ID after saving. Revert or mark it failed if the backend rejects the request.