问题标签 [bayeux]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
305 浏览

java - 如何使用 CometD 向频道的所有 Javascript 订阅者发布消息?

给定一个使用 CometD 的 Java Web 应用程序,我如何在bayeux 每次处理消息时向所有频道的订阅者发布消息?

为了测试,我使用了serverSession.deliver(serverSession, "/test-channel", map, null);.

结果是我的 Javascript 客户端将成功订阅,但仅收到 10 次尝试中的 1 次消息。因此,在 90% 的情况下,浏览器从未收到任何消息,但 Bayeux 日志记录(级别 3)显示它们每次都被发送到正确的通道。

我应该使用某种形式的客户端会话吗?CometD 文档似乎有点不清楚。

0 投票
1 回答
1726 浏览

iphone - 用于 iPhone 的 CometD/Bayeux 客户端

我正在寻找适用于 iPhone 的 Bayeux/CometD 客户端。Objective-C 实现会起作用。知道我可以从哪里得到它吗?或者知道如何为 iphone 创建一个 cometD 客户端。

0 投票
1 回答
2261 浏览

java - 使用 CometD Java 客户端发布可供 Javascript 订阅者使用的消息

我有一个使用 CometD 的 Java Web 应用程序。工作流程很简单:

  1. 我已经定义了一个服务,它在接收通道“/service/hello”上的消息时起作用。该服务需要一个参数“名称”。基于此,它创建了一个名为: 的频道"/"+message.getDataAsMap().get("name")。它向这个频道附加了一个回调方法,该方法将向所有订阅者发送回一条消息。
  2. Javascript 客户端(使用 dojo)向通道“/service/hello”发布消息,并订阅名称已作为参数发送到“/service/hello”的通道。举个例子:

这工作正常。现在,我想要实现的是:让 Javascript 客户端仅作为订阅者和一个 Java 客户端进行发布。我已经使用 CometD2 文档中为 Java Client API 提供的示例进行了尝试,但它没有按预期工作。似乎调用了服务,但 Javascript 消费者看不到消息。

有可能实现这一目标吗?有什么错误的想法吗?谢谢。

这是服务器端的代码:

0 投票
1 回答
669 浏览

jetty - OSGi、Jetty 和 CometD/Bayeux

我让 Jetty 和 Bayeux 一起工作得很好,让我可以将 comet 与 dojo 一起使用。但是,我现在需要迁移到 OSGi 码头环境并且正在努力让它工作。

在非 OSGi 环境中,以下行有效并让我启动服务等。但是,在 OSGi 中,servlet 上下文/配置中没有属性“BayeuxServer.ATTRIBUTE”。

有没有人有任何示例代码、博客文章、参考文章等来帮助解决这个问题?谷歌搜索没有任何结果!

谢谢,埃德

0 投票
1 回答
2323 浏览

jquery - jquery.cometd 初始化问题

我正在尝试创建一个简单的测试 HTML 页面,该页面显示来自 Bayeux 服务器的消息。

这是代码:

当我尝试打开此页面时,我收到以下 javascript 错误:org is not defined at line 20 of jquery.cometd.js。有问题的行是:

这是我下载的一个库,我想我在这里做错了,但我不知道它是什么。

在此先感谢,米查

0 投票
1 回答
2017 浏览

comet - Http Server Push with Netty + protobuf

We're designing a communications system for supporting asynchronous near-realtime server pushing of events/messages to thousands of clients acrros JVM, .Net and mobile platforms. We have a mixed model (both publish-subscribe and request-response) and binary data.

We are using Netty and Google Protocol Buffers and we need to encapsulate all this in http(s).

We were looking into the Bayeux Protocol and its Netty implementation and were inclined to use a modified version of it with protobuf codecs instead of JSONs' or roll our own starting from the WebSockets example (client and server). For performance concerns we would stay out of Base64 encodings an the like.

Are there any implementations that we are missing? How feasible would it be to do a protobuf-based Bayeux protocol? Any pointers are greatly appreciated.

0 投票
1 回答
517 浏览

javascript - 彗星消息发送两次

我想在我的项目中使用 Cometd,并在 Tomcat 7 服务器上尝试了它的 Jetty 8 版本。它有效,但消息被发送两次。

为了检查它是否与项目的其余部分有关,我设置了一个只有此功能的独立项目,但我仍然收到两次消息。

我不知道为什么会这样。

项目中有5个文件:

  • pom.xml
  • web.xml
  • 索引.html
  • BayeuxInitializer.java
  • 表单数据服务.java

以下是每个文件的代码:

  • web.xml

    /li>
  • 索引.html

    /li>
  • BayeuxInitializer.java

    /li>
  • 表单数据服务.java

    /li>
  • pom.xml

    /li>
0 投票
2 回答
262 浏览

java - appserver/平台无关的bayeux实现

我计划创建一个bayeux实现(彗星),即一个图表应用程序,它从服务器中提取数据并相应地更新图表

但是无论如何我可以创建一个与平台无关的bayeux实现

即,如果我为 Weblogic 开发,它是否也可以在 Websphere 上工作

请让我知道你的想法

谢谢

0 投票
1 回答
469 浏览

jquery - Jquery 的 Bayaux 协议实现


我们有一个在 jQuery 上运行的应用程序。在这方面,需要实现Bayaux 协议。但是据我所知,只有DOJO以 cometd 的形式实现了 Bayaux协议

由于我们完全依赖于 jQuery,我们不能仅仅为此实现导入整个dojo 工具包版本。

我的问题是 -
是否有针对 Jquery 的 Bayaux(cometd) 实现?
如果没有,是否有任何提供此实现的微框架?
如果不是,我可以从 Dojo 工具包中提取任何与 Bayaux 相关的内容并排除其他所有内容吗?

0 投票
1 回答
869 浏览

php - Are there any mature PHP clients for Bayeux / CometD?

I'm in the process of evaluating different AJAX push servers, one of them of course is CometD - which uses the Bayeux protocol. Since the application server code will be based on PHP 5.3, it would be great not to reinvent the wheel and use an existing library to publish data via CometD.

The only class I found so far is Phomet. However, it is not maintained anymore, obviously still contains debug code and also sometimes produces errors with the latest CometD server (2.3/2.4). Any recommendation is much appreciated! Maybe somebody also came across Phomet and improved it?