/*------------------------------------------------------ */ //-- 需要安装websocket,我用的是下面链接提供的 //-- https://github.com/Textalk/websocket-php /*------------------------------------------------------ */ //客户端 require('vendor/autoload.php'); $client = new WebSocketClient("ws://124.222.224.186:8800"); $client->text("Hello WebSocket.org!"); echo $client->receive(); $client->close(); //服务端 $server = new WebSocketServer(); $server->accept(); $message = $server->receive(); $server->text($message); $server->close();
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...