views:

282

answers:

1

Hopefully this isn't too specific/small a question, but I was wondering if anyone knew what the possible arguments are for the dojo cometd subscribe() function?

The few examples I've seen indicate two parameters

cometd.subscribe(channel, call_back);

but a few implementations I've seen include a boolean and a possible object to the parameter list and reading through the code indicates the function can handle 4 arguments. I'm trying to look through the code and see where they actually end up, but it's taking a while to sort through the code - I was hoping someone here might know something so obscure.

On a slightly connected thread - does anyone know if there's more documentation for using cometd than the pitiful fare to be found at cometdproject?

+1  A: 

The three argument versions I've seen are subscribe(channel, callBackRecipient, callBackMethod); The second argument is the object to which to send a message, and the third (like the second in the 2-arg version) is the method to send.

The call_back method can be called with a varying number of arguments as well. According to the documentation at Mortbay, the callback method takes 2, 3, or 4 arguments.

myMethod(Client fromClient,Object data)
myMethod(Client fromClient,Object data,String id)
myMethod(Client fromClient,String channel,Object data,String id)

Client and channel should be obvious. data is the data in the publish() msg, and id is a unique ID for the message.

PanCrit