socket.io v4的PHP发射器

发布于 2025-01-22 18:24:20 字数 716 浏览 4 评论 0原文

我一直在尝试为socket.io v4实现PHP客户端。尽管这看起来很容易,但我注意到GitHub中的以下趋势:

  1. 客户端是redis emitter(?)
  2. 客户端与socket.io v4客户端不兼容
  3. 客户端仅连接到socket.io服务器(加密问题i i猜猜)

问题仍然存在。 socket.io v4是否有兼容的PHP客户端类?


这个客户端与V4兼容。

首先,在第77行上,我已经更新了代码,以使查询与socket.io v4兼容:

public function __construct($host = null, $port = null, $path = "/socket.io/?EIO=4")

在第311行中深入研究,PHP将加密的数据写入插座。这是执行握手的地方。但是没有正确的数据通过套接字发送。

fwrite($fd, $this->hybi10Encode('42["' . $this->event . '", "' . addslashes($this->getData()) . '"]'));

I've been trying to implement a PHP client for socket.io v4. Though this looks easy, I've noticed the following trends within GitHub:

  1. The client is a Redis emitter (?)
  2. The client is not compatible with socket.io v4
  3. The client simply is not connecting to the socket.io server (encryption issue I guess)

The question remains, however. Is there a compatible PHP client class for socket.io v4?

This client is the one that looks ok but is not compatible with v4.

First, on line 77 I've updated the code to make the queries compatible with socket.io v4:

public function __construct($host = null, $port = null, $path = "/socket.io/?EIO=4")

Diving a little deeper on line 311, php is writing the encrypted data onto the socket. This is where the handshake is performed. But no correct data is being sent over the socket.

fwrite($fd, $this->hybi10Encode('42["' . $this->event . '", "' . addslashes($this->getData()) . '"]'));

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

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

发布评论

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

评论(1

滥情空心 2025-01-29 18:24:20

我找到了与socket.io 4x一起使用的Elephant.io库( https://github.com/象/大象。

I found the Elephant.io library, which works with socket.io 4x (https://github.com/ElephantIO/elephant.io)

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