In my last blog entry, I shared some nodejs-code to read CouchDB’s _changes
feed and publish the data to a website. In order to update the page in a continous fashion, I used socket.io which provides a nifty abstraction across server- to client-side transports — for example, websockets and ajax longpoll.
Full-throttle
When we tested the code for a few days over the weekend, the largest issue we ran into was that the stream moved too fast. In fact it moved so fast, we couldn’t read anything and were at risk of getting a seizure when we watched the page for too long.
Certainly awesome from one point of view — people are using the website — but it also led to the next objective: I had to find a way to throttle broadcasting to the client. Here’s how!