PHPDaemon\Examples\ExampleWebSocketRoute::onFrame PHP Méthode

onFrame() public méthode

Called when new frame received.
public onFrame ( $data, $type ) : void
Résultat void
    public function onFrame($data, $type)
    {
        if ($data === 'ping') {
            $this->client->sendFrame('pong', 'STRING', function ($client) {
                // optional. called when the frame is transmitted to the client
                \PHPDaemon\Core\Daemon::log('ExampleWebSocket: \'pong\' received by client.');
            });
        }
    }
ExampleWebSocketRoute