4 pages tagged across the site.
A bidirectional relationship — users know their rooms, rooms know their users — has to be updated under a single lock, or readers will catch it half-done.
A WebSocket connection that needs periodic pings to stay open shouldn’t run that ping loop on a plain, non-daemon thread. In the WazirX Java connector , the ping thread is started onOpen and marked setDaemon(true) before starting it: pingThread = new Thread(new PingMessage(this)); pingThread.setDaemon(true); pingThread.start(); A non-daemon thread keeps the JVM alive until it finishes. If a caller opens a socket, forgets to close it, and the rest of the application shuts down, a non-daemon ping thread will keep the process running indefinitely. A daemon thread just gets killed when everything else is done — which is the right default for background keepalive work that isn’t itself the point of the program.
A thread-safe Go library providing a reusable Room–User architecture for real-time systems like chat and multiplayer games.
The canonical Go book — worth a proper read now that Go is my main language.