问题标签 [ratchet]

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 投票
0 回答
271 浏览

session - ZfcUser and the SessionHandler in Ratchet

I'm want to be able to view the ZfcUser sessions in the I/O server of Ratchet.

However, out of the box only Symphony 2 Sessions are supported with the SessionProvider of Ratchet.

And I seriously don't know what to do next to make this work.

--

  1. Either extend the ZfcUser to use the Symphony 2 Session.
  2. Make the SessionProvider of Ratchet work with the way ZfcUser handles his Sessions.
  3. Or a workaround were I save the sessions to a database and use a SELECT query on the I/O server? ( like this )

--

The way Ratchet uses the SessionProvider is like this:

Any ideas on how to go furter?

0 投票
1 回答
1780 浏览

php - 在 Windows 上设置 react/zmq

我正在按照官方网站的说明在我的系统上设置 Ratchet,我执行了以下操作:

  1. 从官网下载并安装zeromq
  2. 按照http://zeromq.org/bindings:php的说明进行 PHP 绑定并复制 dll 文件(由于提到的 url 已关闭,我从 [ http://178.79.157.189/~mikko/win32/获取了 dll 文件php-zmq-win32.zip] ) 3.修改php.ini文件。

但是当我重新启动服务器时,我得到了错误:

PHP 启动:无法加载动态库 'c:/wamp/bin/php/5.4.3/ext/php_zmq.dll' - %1 不是有效的 Win32 应用程序。

0 投票
1 回答
723 浏览

wamp - Ratchet WAMP $topic error:Call to a member function broadcast() on a non-object

The title says it all.Here's my code:

...and the "onUpdate" function...

...the "onPublish" function:

The client code is trivial.

I am sure the bug, if any (I've been at this for about 10 hours), does not reside there.

I confirm via the console that indeed the browser is subscribed to "Prime_mover". This also shows up on the CLI. In addition, I have put a button that publishes to this channel, via the "onPublish" function. This works.

As can be seen above, I am not using ZeroiMQ for IPC because I am developing on a windows machine, on PHP 5. AFAIK, there exists no working ZeroMQ bindings for PHP5.

I resorted to using bare sockets. They work just as beautifully, and I can see on the CLI that the messages do get to this particular script.

The "onUpdate" function does get called, confirmed, again, via the CLI.

I had previously tried using the URL "http:\example.com\Prime_mover", when it did not work, out of desperation, I tried the string "Prime_mover". You're probably shaking your head right now-I know, does't work that way.

I have tried to use $topica as an array too, does not work.I guess the most important question here is, what kind of object is $topic, why won't a simple string work in it's place?Am I missing something here?How is it "constructed" correctly?

0 投票
1 回答
513 浏览

php - 在 SilverStripe 中运行的 Ratchet Web 套接字服务器

我正在尝试运行 Ratchet WebSocket 服务器,该服务器可以DataObject从 SilverStripe 实例访问 s ,该实例可以作为终端的长时间运行进程运行。

我目前的方法是使用与定义相同的数据库配置cli-script.php包含core/Core.php并连接到数据库model/DB.php_config.php

有没有更好的方法不涉及复制代码cli-script.php?虽然我只有一个可以启动服务器的控制器,但这听起来也是错误的。

另一个想法是将它们分开并使用 SS REST API 在它们之间进行交互,但与 PHP 对象交互会更简单。

0 投票
1 回答
686 浏览

cakephp - 使用 CakePHP 在 Ratchet 上的模型推送行为出现问题

我在使用 Ratchet 的 WyriHaximus 的 CakePHP 插件让模型推送行为工作时遇到了一些麻烦:https ://github.com/WyriHaximus/Ratchet

我已经安装了它,让服务器正常工作并连接到它。但是每当我向模型添加推送行为时,它都会给我一个 Missing Behavior 错误,因为插件不包含一个。但是它有一个姐妹插件。

我已经尝试将两者合并,但我认为它的设计目的是与其协同运行。所以我很茫然。

在我的模型中,我有:

一切都被引导,加载,它只是不与其他插件说话。有人有过让这个工作的经验吗?

0 投票
1 回答
2552 浏览

php - 将请求路由到 Laravel 控制器以运行 WebSocket 服务器

情况:

有一个长时间运行的任务需要异步启动。这个任务的细节并不是那么重要(基础是要配置多个虚拟机和复杂的网络设置),这是由将在不同服务器上运行的 python 脚本处理的。我们决定使用 WebSockets 来进行 Web 服务器和客户端之间的来回通信,并且我可以在那里进行双向通信。Web 服务器将向另一台服务器发送请求,并在每台机器启动并运行时接收来自 python 脚本的 HTTP POST 通知,并在整个网络启动时收到最终的 HTTP POST。

所有这些都有效。我们在 Web 服务器上使用的框架是 Laravel 4,而 Web 套接字服务器是使用Ratchet构建的,并在 artisan 命令中实现。我的问题是我不确定如何将 HTTP POST 从 python 脚本中继到 Laravel 控制器到 WebSocket 服务器,以便它反过来可以将该信息中继回客户端。

下面是 RatchetMessageComponentInterface::onMessage方法的实现,它使用观察者模式来通知任何订阅的侦听器消息事件。

WebSocket 服务器是在这样的服务提供者中构建的:

有没有办法在给定控制器的方法被命中时向 Laravel 控制器发出请求并通知正在运行的 WebSocket 服务器?

0 投票
1 回答
1074 浏览

php - 使用reachphp 或ratchet 在预定时间发布给订阅的客户

我是 reactphp 新手。我涉足 node.js。我正在研究一个需要在特定时间触发事件并将其发布给订阅客户的项目。这是 EventLoop 适合的东西吗?关于我如何解决这个问题的任何方向?

0 投票
1 回答
382 浏览

zeromq - 无法设置棘轮

我正在尝试在我的系统上设置 Ratchet 并遵循 socketo.me 我已经完成了所有工作,直到安装 ZMQ 和 React/Zmq 并且一切都成功了。

但是当我尝试运行时push-server.php,会出现以下错误:

我已经设置了 PATH 变量并启用了 php_zmq 扩展(我在 Windows 上使用 WAMP)。我已经搜索了很多,但无法解决这个问题,请帮助。

0 投票
1 回答
9818 浏览

ssl - Ratchet + nginx + SSL/安全 websocket

我一直在尝试通过 SSL 运行 Ratchet.io(这个问题:php ratchet websocket SSL connect?)。

我的网络服务器在 myhost.mobi 上运行,并且我为 websocket 服务“wws.myhost.mobi”创建了一个单独的虚拟主机。

我的网络套接字:

我的 nginx 配置(我在 nginx 1.5.8 上):

我的客户端脚本:

因此,当我在 Firefox 中加载页面时,我看到到 wss://wss.myapp.mobi:8080/ 的传出连接,该连接挂起(微调器)并且永远不会完成或终止。我在日志中没有看到任何请求到达后端的痕迹。

我在那里想念什么?

谢谢!

编辑我意识到我应该连接到wss://wss.myapp.mobi,但现在我得到了“101 Switching Protocols”状态。

编辑 2现在一切都在使用上面的配置。“101 Switching Protocols”状态原来是一条正常消息。问题解决了!

0 投票
1 回答
7909 浏览

php - 无法绑定到 tcp://127.0.0.1:8080:地址已在使用中

在开发了大部分站点之后,我需要引入将数据从服务器推送到客户端的能力。经过一番研究,我决定使用 Ratchet(我使用的是 Laravel 4.1)。

我已经实现了我的 pushUpdate 类,但是我在启动 webSocket 服务器时遇到了问题,我目前启动服务器的方法是:

当请求需要推送更新的页面时运行此代码。这是我收到的错误:

我之前没有实现过 webSocket,我已经阅读了服务器配置文档(http://socketo.me/docs/deploy#serverconfiguration),其中指出我可以在端口 8080 上运行 web 和套接字服务器。

任何帮助解决这个问题都非常感谢。