Skip to content

Instantly share code, notes, and snippets.

@TheNotary
Last active February 27, 2023 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheNotary/4f2995394f19c0cc58eff8a708bbc5df to your computer and use it in GitHub Desktop.
Save TheNotary/4f2995394f19c0cc58eff8a708bbc5df to your computer and use it in GitHub Desktop.
Websocket connection and reconnection
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TheNotary
Copy link
Author

TheNotary commented Feb 2, 2023

Backend-heavy Pros:
  • Minimizes work/ requests by user and keeps more transactions within the cloud
  • Allows the client to have their token refreshed without coupling that act with reconnecting to the backend???
    • (so they don't reconnect unless they come back to their machine)
🌟 Client-heavy Pros:
  • Eliminates the need for defining a "reconnect" message (since our reconnect message can simply be GCP terminating the connection)
  • Eliminates the need to schedule the reconnect request every 5 minutes since we can rely on GCP just terminating the connection
  • Allows client to reconnect seamlessly during redeploy
Home-rolled Session Token Pros:
  • Eliminates the need to interact with OAuth providers (for as long as they keep their browser open so the OAuth partner isn't needed for image lookups... I should re-write that....)
  • Allows us to decide the durations and limitations of their session... just check when the session was created and if it's expired, delete it from the db if it's no good.

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