socket.io v4的PHP发射器
我一直在尝试为socket.io v4实现PHP客户端。尽管这看起来很容易,但我注意到GitHub中的以下趋势:
- 客户端是redis emitter(?)
- 客户端与socket.io v4客户端不兼容
- 客户端仅连接到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:
- The client is a Redis emitter (?)
- The client is not compatible with socket.io v4
- 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了与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)