相关疑难解决方法(0)

Socket.io 3 和 PHP 集成

我使用 PHP SocketIO 类连接 NodeJS 应用程序并发送消息。Socket.io 2 一切都运行得很好,但升级到版本 3 后,PHP 集成停止工作。

当我发送请求时,我收到以下回复:

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: hNcappwZIQEbMz7ZGWS71lNcROc=
Run Code Online (Sandbox Code Playgroud)

但即使我尝试使用“连接”事件记录与服务器的任何连接,我也没有在 NodeJS 端看到任何内容。

这是 PHP 类:

class SocketIO
{
    /**
     * @param null $host - $host of socket server
     * @param null $port - port of socket server
     * @param string $action - action to execute in sockt server
     * @param null $data - message to socket server
     * @param string $address - addres of socket.io on socket …
Run Code Online (Sandbox Code Playgroud)

php sockets websocket node.js

1
推荐指数
1
解决办法
5374
查看次数

标签 统计

node.js ×1

php ×1

sockets ×1

websocket ×1