传递给 cometd.subscribe() 的参数

发布于 2024-07-13 22:34:10 字数 453 浏览 3 评论 0 原文

希望这不是一个太具体/小问题,但我想知道是否有人知道 dojo cometd subscribe() 函数可能的参数是什么?

我见过的几个例子表明有两个参数

cometd.subscribe(channel, call_back);

,但我见过的一些实现包括一个布尔值和一个可能的对象到参数列表,通读代码表明该函数可以处理 4 个参数。 我试图查看代码并查看它们实际上最终在哪里,但是需要一段时间才能对代码进行排序 - 我希望这里有人可能知道一些如此晦涩的东西。

在一个稍微相关的线程上 - 有谁知道是否有更多使用 cometd 的文档,而不是在 cometdproject< /a>?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

屌丝范 2024-07-20 22:34:10

我见过的三个参数版本是 subscribe(channel, callBackRecipient, callBackMethod); 第二个参数是要发送消息的对象,第三个参数(如 2-arg 版本中的第二个参数)是要发送的方法。

call_back 方法也可以使用不同数量的参数来调用。 根据 Mortbay 的文档,回调方法采用 2、3 或 4 个参数。

myMethod(Client fromClient,对象数据)
myMethod(Client fromClient,对象数据,字符串id)
myMethod(Client fromClient,String channel,Object data,String id)

客户端和通道应该是显而易见的。 data 是publish() 消息中的数据,id 是消息的唯一ID。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文