Ticket #4500 (closed enhancement: fixed)
[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
Change History
Note: See
TracTickets for help on using
tickets.