Fixed errors in examples
This commit is contained in:
parent
98324121f1
commit
ea9865c177
@ -30,9 +30,9 @@ $websocket = new NoccyLabs\React\WebSocket\WebSocketMiddleware();
|
|||||||
|
|
||||||
// Connect event handler, receives a WebSocketInterface.
|
// Connect event handler, receives a WebSocketInterface.
|
||||||
// Ratchet handles security for you, this library does not. You should
|
// Ratchet handles security for you, this library does not. You should
|
||||||
// check everything important in the connect handdler and reject anything
|
// check everything important in the connect handler and reject anything
|
||||||
// that does not smell right. Here we just echo everything.
|
// that does not smell right. Here we just echo everything.
|
||||||
$websocket->on('connect', function (NoccyLabs\React\WebSocket\WebSocketInterface $connection) {
|
$websocket->on('connection', function (NoccyLabs\React\WebSocket\WebSocketInterface $connection) {
|
||||||
$websocket->on('text', function ($text) use ($websocket) {
|
$websocket->on('text', function ($text) use ($websocket) {
|
||||||
$websocket->write($text);
|
$websocket->write($text);
|
||||||
});
|
});
|
||||||
|
@ -11,7 +11,7 @@ use React\Promise\Promise;
|
|||||||
use React\Socket\SocketServer;
|
use React\Socket\SocketServer;
|
||||||
|
|
||||||
$websockets = new WebSocketMiddleware();
|
$websockets = new WebSocketMiddleware();
|
||||||
$websockets->on('connect', function (WebSocketInterface $websocket) {
|
$websockets->on('connection', function (WebSocketInterface $websocket) {
|
||||||
$websocket->on('text', function ($text) use ($websocket) {
|
$websocket->on('text', function ($text) use ($websocket) {
|
||||||
if (str_starts_with($text, '#')) {
|
if (str_starts_with($text, '#')) {
|
||||||
$websocket->setGroup(substr($text,1));
|
$websocket->setGroup(substr($text,1));
|
||||||
|
Loading…
Reference in New Issue
Block a user