Ticket #4500 (closed enhancement: fixed)

Opened 11 months ago

Last modified 11 months ago

[patch/ccla] Clean up cometd.js a bit, improve reporting for subscribe/unsubscribe

Reported by: guest Owned by: alex
Priority: normal Milestone:
Component: Dojox Version: 0.9
Severity: normal Keywords: cometd
Cc: brendonh@…

Description

This ticket does a couple of things:

  • Removes two places where arguments were introspected and swapped. These were for back-compat but I understand there'll be a clean API break for 1.0.
  • Removes "/meta/subscribe" handling from longPollTransport.deliver() (and thereby also callbackPollTransport). In fact this code was unreachable anyway, because cometd._deliver() handles it and then never calls the transport's deliver.
  • Adds two maps to cometd -- pendingSubscriptions and pendingUnsubscriptions. When the application calls cometd.subscribe() or cometd.unsubscribe(), a Deferred is created, stored in one of these maps, and returned to the user. Later, when the response comes in from the server, the same Deferred is looked up and fired. This means the application can be informed of the success or failure of these operations.

I originally tried to do this by changing the deferred returned by xTransport.sendMessage, then realised that the response from the server can come on /any/ connection, so the transport is the wrong place for it. It now seems to me that messages (/all/ messages) should have a messageID field which allows responses to be uniquely mapped to requests. Until we have that in the Bayeux protocol, looking up by subscription channel is the best we can do.

Attachments

patch.txt (5.3 kB) - added by guest 11 months ago.
patch2.txt (10.4 kB) - added by guest 11 months ago.

Change History

Changed 11 months ago by guest

Changed 11 months ago by dante

  • owner changed from ttrenka to alex
  • summary changed from Clean up cometd.js a bit, improve reporting for subscribe/unsubscribe to [patch/ccal] Clean up cometd.js a bit, improve reporting for subscribe/unsubscribe

ccla via Cogini? not verified. but talked to brendon.

Changed 11 months ago by dante

  • summary changed from [patch/ccal] Clean up cometd.js a bit, improve reporting for subscribe/unsubscribe to [patch/ccla] Clean up cometd.js a bit, improve reporting for subscribe/unsubscribe

Changed 11 months ago by alex

  • status changed from new to assigned

this patch needs work. Dojo style is to use 4-space tabs instead of spaces, to remove spaces before and after conditions, and to make sure that expressions are space-efficient. The following line:

(pendingDef !== undefined)

and those like it should be re-written as:

(!pendingDef)

Please consult the style guide: http://dojotoolkit.org/developer/StyleGuide

Regards

Changed 11 months ago by guest

Fair enough. Here's a second version (patch2.txt) with the following changes:

  • All 4-space blocks changed to tabs. Some of the code in the original 0.9 file didn't follow this, so there's some cruft in the patch to convert it.
  • Trailing whitespace removed from all lines. As above, this affects some original code.
  • Spaces removed around conditional expressions.
  • if(pendingDef !== undefined) changed to if(pendingDef), which I'm pretty sure is what you meant to type.

Cheers, Brendon

Changed 11 months ago by guest

Changed 11 months ago by alex

  • status changed from assigned to closed
  • resolution set to fixed

(In [10573]) merging patch from brendonh@…. Nice work. Fixes #4500

Note: See TracTickets for help on using tickets.