Too Long; Didn't Read
The simplest solution is to use a server-side session cache that generates and stores a session ID for each user ID. We can implement this API in two ways: polling and server-push. We want a client-side function that can tell us when the session is no longer valid: polling. We need to make a trade-off between a shorter polling interval and shorter latency. If a user successfully logs in, the session ID will be overridden. This post covers how to build, improve, and scale this feature.