PHPDaemon\SockJS\Session::sendPacket PHP Method

sendPacket() public method

sendPacket
public sendPacket ( object $pct, callable $cb = null ) : void
$pct object [@todo description]
$cb callable [@todo description]
return void
    public function sendPacket($pct, $cb = null)
    {
        if (sizeof($this->framesBuffer)) {
            $this->buffer[] = 'a' . $this->toJson($this->framesBuffer);
            $this->framesBuffer = [];
        }
        $this->buffer[] = $pct;
        if ($cb !== null) {
            $this->onWrite->push($cb);
        }
        $this->flush();
    }