【PHP】PHPでWebSocketサーバー - クライアント・サーバー間通信 -

前回の記事 でPHPにより実装したWebSocketサーバーを介してのクライアント間通信を実装しました。 今回はサーバー側から一方的にクライアントへメッセージを送信してみたいと思います。 使用するライブラリは以下を使用しましたが、結果を先に言ってしまうとelephant.ioのほうはうまく行きませんでした。以下にその手順と結果を残しておきます。 wisembly/elephant.io textalk/websocket サーバーからメッセージ送信 (wisembly/elephant.io) ライブラリのインストール composer.json composer.json の require に以下を追加 "wisembly/elephant.io":"~3.0" 以下コマンドでインストール $ ./composer.phar update --lock Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing wisembly/elephant.io (v3.3.1): Loading from cache Package guzzle/common is abandoned, you should avoid using it. Use guzzle/guzzle instead. Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead. Package guzzle/parser is abandoned, you should avoid using it. Use guzzle/guzzle instead. Package guzzle/stream is abandoned, you should avoid using it. Use guzzle/guzzle instead. ...