Opened 12 years ago

Closed 7 years ago

#5963 closed enhancement (wontfix)

Comet - subscribing to a glob channel

Reported by: guest Owned by: dylan
Priority: high Milestone: future
Component: DojoX Cometd Version: 1.0
Keywords: comet, glob, subscribe, channel Cc: geoffreyj.lee@…
Blocked By: Blocking:

Description (last modified by dylan)

Subscribing to the * channels doesn't seem to work. Let's say we have the channels /foo and /bar. When the user subscribes to /*, the user does a client-side dojo.subscribe to /*, but the actual message will be published to either /foo or /bar on the client side. In other words, the server delivers the messages to the client, but the client is listening on a different Dojo channel.

I wasn't sure what to set the ticket properties to, so I'm hoping somebody else will edit them.

-Geoffrey Lee

Change History (12)

comment:1 Changed 12 years ago by alex

Milestone: 1.2
Owner: changed from anonymous to alex
Status: newassigned

comment:2 Changed 12 years ago by dylan

Milestone: 1.21.1

move back to 1.1 per request by Greg Wilkins.

comment:3 Changed 12 years ago by gregwilkins

I think this is simply because dojo.subscribe does not support wild cards.

So I think that when we receive a message on channel /foo/bar/boo then we should publish it to dojo topics:

/cometd/ /cometd/foo/ /cometd/foo/bar/ /cometd/foo/bar/* /cometd/foo/bar/boo

Is that reasonable?

comment:4 Changed 12 years ago by guest

Seems reasonable to me. Here's the modified code for dojox.cometd._deliver that I'm using to do this:

// dispatch the message to any locally subscribed listeners
try {
	var tname = "/cometd"+message.channel;
	dojo.publish(tname, [ message ]);
	
	// Begin changes
	var tnameParts = message.channel.split("/");
	var tnameGlob = "/cometd";
	for (var i = 1; i < tnameParts.length - 1; i++) {
		dojo.publish(tnameGlob + "/**", [ message ]);
		tnameGlob += "/" + tnameParts[i];
	}
	dojo.publish(tnameGlob + "/**", [ message ]);
	dojo.publish(tnameGlob + "/*", [ message ]);
	// End changes
}catch(e){
	console.debug(e);
}

-Geoffrey Lee

comment:5 Changed 12 years ago by gregwilkins

Great!

I've committed with the slight change of publishing to the real topic after the glob topics, so that it is like we have descended the tree.

If you can test this, I will see if it can make it into 1.1

comment:6 Changed 11 years ago by bill

Component: GeneralDojox
Milestone: 1.11.2

Move all milestone 1.1 tickets to 1.2, except for reopened tickets and tickets opened after 1.1RC1 was released.

comment:7 Changed 11 years ago by dylan

Description: modified (diff)

Marked #4961 as a duplicate of this ticket. Also, #6385 is a request to add this to dojo.publish() and dojo.subscribe().

comment:8 Changed 11 years ago by Adam Peller

Component: DojoxDojoX Cometd

comment:9 Changed 11 years ago by Dustin Machi

Type: defectenhancement

comment:10 Changed 11 years ago by bill

Milestone: 1.2future

comment:11 Changed 8 years ago by Chris Mitchell

Owner: changed from alex to dylan

please review/triage

comment:12 Changed 7 years ago by bill

Resolution: wontfix
Status: assignedclosed

The CometD library has been removed from DojoX. The CometD project now maintains its own Dojo library in AMD format as part of their project. This will be available via cpm, or may be downloaded from GitHub?. See: http://cometd.org/

Note: See TracTickets for help on using tickets.