4 ms·
The sweet spot for node.js to me would seem to be soft realtime applications. For example you might build a twitter clone where you wish for new tweets to be au
by jiggy2011 12y ago
The sweet spot for node.js to me would seem to be soft realtime applications.
For example you might build a twitter clone where you wish for new tweets to be automatically pushed to the browser via JSON/Websocket etc.
On the backend you might implement a pub/sub system where events are raised upon a tweet being made and these events are filtered into different queues.
So you might implement a waitForNewTweet() function which will wait for an event on the queue. But this method could take a very long time to return, and all of this time the client is holding open a socket on the server.
If waitForNewTweet() blocks then that thread will no longer be able to do other work, so each client must allocate a new thread. So if you have many client connected for long periods waiting for tweets then that is going to be a lot of threads.