Does Cord use websockets or short polling for all of the real-time chat and presence features?
I want to learn how Cord makes live messages work, does it use websockets, short polling...
Cord uses WebSockets. Specifically, we use one websocket per page, regardless of how many Cord components you include on the page (you can inspect the page on our demo apps to see the websocket details).
If you want a bit more flavor, Cord's backend uses a combination of traditional database storage (powered by Postgres) and pubsub functionality built on top of Redis. When a user loads a page that has Cord components, the Cord client side libraries use Apollo to make a GraphQL subscription to Cord's backend. The subscription sits active on the backend as long as the client is connected.
When a message (or notification, presence update, typing indicators, etc.) comes in, Cord's backend executes some logic to determine if any active subscription needs to know about it. So, when User A sends a message on the same page as User B, Cord's backend will know that 1) User B is connected and waiting and 2) User B has not yet seen this message. Cord's backend will send the message down as a GraphQL payload which gets handled by the client side library and turned into a message that User B will see on their screen.