PHPDaemon\SockJS\WebSocketRouteProxy::onFrame PHP Method

onFrame() public method

Called when new frame received.
public onFrame ( string $data, integer $type ) : void
$data string Frame's contents.
$type integer Frame's type.
return void
    public function onFrame($data, $type)
    {
        foreach (explode("\n", $data) as $pct) {
            if ($pct === '') {
                continue;
            }
            $pct = json_decode($pct, true);
            if (isset($pct[0])) {
                foreach ($pct as $i) {
                    $this->onPacket(rtrim($i, "\n"), $type);
                }
            } else {
                $this->onPacket($pct, $type);
            }
        }
    }