Skip to content

rename session connect/disconnect -> created/closing/closed#288

Merged
jackyzha0 merged 5 commits intomainfrom
jackyzha0/distinguish-session-events
Feb 14, 2025
Merged

rename session connect/disconnect -> created/closing/closed#288
jackyzha0 merged 5 commits intomainfrom
jackyzha0/distinguish-session-events

Conversation

@jackyzha0
Copy link
Copy Markdown
Member

@jackyzha0 jackyzha0 commented Feb 14, 2025

Why

nomenclature of 'connected'/'disconnected' is an artifact of when sessions were what connections are today, thats no longer accurate

this also allows us to disambiguate the 'about to close' state and 'already closed' state

these have two different cases:

  1. about to close -> do any last minute cleanup and send things to the otherside before we totally yank the connection
  2. already closed -> consumers can do things like manually open a new session if an old session is closed

What changed

  1. rename 'connect' -> 'created', 'disconnect' -> 'closing'
  2. add a new 'closed' state which is emitted after the cleanup is done
  3. fix a case where we could loop infinitely by mutating a map while iterating its values
  4. add a test for the create a new session after previous session is gone case

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

@jackyzha0 jackyzha0 requested a review from a team as a code owner February 14, 2025 20:22
@jackyzha0 jackyzha0 requested review from blast-hardcheese and removed request for a team February 14, 2025 20:22
"name": "@replit/river",
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
"version": "0.204.0",
"version": "0.205.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1️⃣ wen

if there's no good answer, let's do it on Apr 1 (pls also blogpost)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes i'd like to! faris thinks that we need more docs but tbd on what we still need there

@jackyzha0 jackyzha0 merged commit 78d5a9e into main Feb 14, 2025
4 of 6 checks passed
@jackyzha0 jackyzha0 deleted the jackyzha0/distinguish-session-events branch February 14, 2025 22:11
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.

2 participants