Skip to content

feat(ipc): preserve channel message order#9070

Merged
lucasfernog merged 1 commit intodevfrom
feat/channel-preserve-order
Mar 4, 2024
Merged

feat(ipc): preserve channel message order#9070
lucasfernog merged 1 commit intodevfrom
feat/channel-preserve-order

Conversation

@lucasfernog
Copy link
Member

@lucasfernog lucasfernog commented Mar 4, 2024

This PR adds a mechanism to preserve message order on tauri::ipc::Channel. It uses a counter that gets sent to the JavaScript side, which processes it and keeps an internal queue if needed.

This was raised on a Discord thread aiming to enhance usability of the websocket plugin.

@lucasfernog lucasfernog requested a review from a team as a code owner March 4, 2024 19:06
@lucasfernog lucasfernog merged commit e62ca4e into dev Mar 4, 2024
@lucasfernog lucasfernog deleted the feat/channel-preserve-order branch March 4, 2024 20:03
// eslint-disable-next-line security/detect-object-injection
const message = this.#pendingMessages[pendingId]
// eslint-disable-next-line security/detect-object-injection
delete this.#pendingMessages[pendingId]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete is advised against for performance reasons, you might consider setting it to null instead.

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.

3 participants