Php 跺脚不回应
我想订阅Spring框架WebSocket并收到回复 根据我的目标WebSocket服务器,通信是使用STOMP发布协议(基于JavaSpringFrameworkAPI构建)完成的 现在,我正在开发的客户端是基于PHP构建的,用于websocket客户端 我接收服务器响应的想法是根据这家伙的回答,采用STOMP-over-Websocket技术 使用当前的websocket客户端,我执行以下步骤Php 跺脚不回应,php,websocket,Php,Websocket,我想订阅Spring框架WebSocket并收到回复 根据我的目标WebSocket服务器,通信是使用STOMP发布协议(基于JavaSpringFrameworkAPI构建)完成的 现在,我正在开发的客户端是基于PHP构建的,用于websocket客户端 我接收服务器响应的想法是根据这家伙的回答,采用STOMP-over-Websocket技术 使用当前的websocket客户端,我执行以下步骤 发送连接(请求?) 发送订阅 积极接受回复 $client = new WebSocket\
$client = new WebSocket\Client($ws_url);
//Step 1 Inintate connection;
$open_msg = "CONNECT\naccept-version:1.0,1.1,2.0\n\n\x00\n";
//Step 2 Subscribe Request;
$client->send($open_msg);
$subs = "SUBSCRIBE\nid:0\ndestination:/user/queue\nack:auto\n\n\x00\n";
$client->send($subs);
while (true) {
try {
$message = $client->receive();
echo $message;
// Act[enter image description here][4] on received message
// Later, Break while loop to stop listening
} catch (\WebSocket\ConnectionException $e) {
// Possibly log errors
}
}
$client->close();
有人知道API为什么不发送回复吗