|
Hi all,
Say I've got an application that's polling on a regular interval for data. I have a number of "data clients" in the browser that all have different remote method calls. Since these aren't user-spawned events, I want to batch them up to all send together, thus only using one connection.
However, during this polling cycle, I've also got user-generated events which result in remote calls. I don't want any delay on these calls .. so I don't want them batched. Is there any way that I can mix batched calls and single shot calls? So .. I'd start a batch, then end it every 5 seconds or so (then immediately start another one). During these batches however, I'd want to send off calls at any time, outside the batch.
Thanks! -d |
|
Maybe I don't understand your question but ... there is nothing special
you need to do this. Simply batch the calls you want batched and make the user-generated calls normally. On 01/17/2012 12:32 PM, Darrell Esau wrote: > Hi all, > > Say I've got an application that's polling on a regular interval for > data. I have a number of "data clients" in the browser that all have > different remote method calls. Since these aren't user-spawned > events, I want to batch them up to all send together, thus only using > one connection. > > However, during this polling cycle, I've also got user-generated > events which result in remote calls. I don't want any delay on these > calls .. so I don't want them batched. > > Is there any way that I can mix batched calls and single shot calls? > > So .. I'd start a batch, then end it every 5 seconds or so (then > immediately start another one). During these batches however, I'd > want to send off calls at any time, outside the batch. > > Thanks! > > -d > |
|
Administrator
|
In reply to this post by Darrell Esau-2
No, the batch APIs only handles one batch at a time so
while a batch is open (between beginBatch and endBatch) every call will belong
to this batch.
Though, the logic that handles this in engine.js is
really really simple, so you could easily override this behaviour by swapping in
and out your desired active batch in the property:
dwr.engine._batch
depending on if a call belongs to the "5s" or "single
shot" category.
Best regards
Mike Wilson
Darrell Esau wrote:
Hi all, |
|
Interesting.
So -- let me walk through this -- 1) I start a batch for polling 2) Add a few methods 3) At this point, I want to single shot something, so I save off dwr.engine._batch to some variable, then set dwr.engine._batch to null.
4) Call my single shot method 5) Reassign dwr.engine._batch to the saved batch, continue adding poll methods 6) After some timer event, end the batch (then start a new one)
Does that sound correct/safe? I've got a bunch of red flags going off in my head .. -d On Tue, Jan 17, 2012 at 2:04 PM, Mike Wilson <[hidden email]> wrote:
|
|
Administrator
|
Yes, that's what I had in mind. Most of engine.js
actually supports concurrent batches, it's just that the public API uses one
global batch for convenience.
Best regards
Mike
Darrell Esau wrote:
Interesting. |
| Powered by Nabble | See how NAML generates this page |
