PHP code example of voryx / websocketmiddleware
1. Go to this page and download the library: Download voryx/websocketmiddleware library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
voryx / websocketmiddleware example snippets
use Ratchet\RFC6455\Messaging\Message;
use React\EventLoop\Factory;
use React\Http\Server;
use Voryx\WebSocketMiddleware\WebSocketConnection;
use Voryx\WebSocketMiddleware\WebSocketMiddleware;
sage);
});
});
$server = new Server($loop, $ws);
$server->listen(new \React\Socket\Server('127.0.0.1:4321', $loop));
$loop->run();
$ws = new WebSocketMiddleware(
[],
$connectionHandler,
[],
WebSocketOptions::getDefault()
->withMaxFramePayloadSize(2048)
->withMaxMessagePayloadSize(4096)
->withPermessageDeflate());