Giter Club home page Giter Club logo

Comments (2)

pfeilbr avatar pfeilbr commented on September 21, 2024 1

Thank you @j-berman for pointing out the stateful challenge and providing the detailed information. I'll review the area of code pointed to.

from userbase.

j-berman avatar j-berman commented on September 21, 2024

Thank you for your interest!

This would be challenging to implement because our design relies on the Userbase server to be stateful.

When a user signs in, their client establishes an authenticated WebSocket connection to the server. Every user-initiated write operation (or "transaction") is sent over this WebSocket. Once the transaction is successfully stored persistently in Dynamo DB, the Userbase server then pushes the transaction out to all connected clients that have that particular database open.

With this design in mind, the Userbase server is stateful for 2 main reasons:

  1. To keep track of which clients are supposed to receive new transactions in real-time.
  2. To ensure the server pushes transactions out to clients in the correct order.

This would be a good place to start to see how the server uses state stored in memory to achieve both goals above.

I'm not familiar with the API Gateway, but my initial reaction is that safely replicating the server's statefulness would be the most challenging thing to achieve. I would guess you would need to push that state out to a database, and I'm not sure if the cost/benefit of doing so is worth it (keeping in mind the performance hit from latency + writing to/reading from disk).

from userbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.