0

I have an application written in pyjamas which must check for new events to update an event table in the browser. It is critical that the events are displayed within a very small window of them happening, so that the operator is aware of the issues in (quasi) real time. I am targeting a delay of under one second.

Currently I am doing JSONRPC calls in pyjamas periodically, to look for new events. The period has been set to 1 second, since a more frequent polling will overload my servers (we are serving lots of customers). Even the 1 second period is too low. And even with this low period, I can not achieve my goal of less than one second (obviously ...). Currently I am on the range of 2-3 seconds, which is too high. Besides, this strategy is overkill, since lots of my requests are receiving no data (since most of the time there are no new events to display).

What I would like is to do some long polling to my server, waiting for an event to happen, and then do the JSONRPC request to get my data. This way the whole event -> display delay will be due to data processing (or network delays), which can be optimized probably (but not avoided).

So my question is: how do I do long polling in pyjamas?

blueFast
  • 41,341
  • 63
  • 198
  • 344
  • Is there any reason you can't use Websockets? They would eliminate the polling and you could notify the listeners immediately when a server side event occurred. – aychedee Jun 20 '12 at 23:01
  • I am not sure how widespread are Websockets nowadays. Anyway, I want to do long polling just for the kick of it :) Seriously: there must be a way to do long polling in pyjamas, isn't there? – blueFast Jun 21 '12 at 05:15

0 Answers0