SocketIO — API
localzet\SocketIO\ChannelAdapter
Section titled “localzet\SocketIO\ChannelAdapter”function __construct($nsp)
function __destruct()
function add($id, $room)
function del($id, $room)
function delAll($id)
function onChannelMessage($channel, $msg)
function broadcast($packet, $opts, $remote = false)localzet\SocketIO\Client
Section titled “localzet\SocketIO\Client”function __construct($server, $conn)
function __destruct()
function setup()
function connect($name)
function nspAdd($socket, $nsp)
function disconnect()
function remove($socket)
function close()
function packet($packet, $preEncoded = false, $volatile = false)
function writeToEngine($encodedPackets, $volatile = false)
function ondata($data)
function ondecoded($packet)
function onerror($err)
function onclose($reason)
function destroy()localzet\SocketIO\Debug
Section titled “localzet\SocketIO\Debug”static function debug($var)localzet\SocketIO\DefaultAdapter
Section titled “localzet\SocketIO\DefaultAdapter”function __construct($nsp)
function __destruct()
function add($id, $room)
function del($id, $room)
function delAll($id)
function broadcast($packet, $opts, $remote = false)
function clients($rooms, $fn)Emitter
Section titled “Emitter”function __construct($ip = '127.0.0.1', $port = 2206, $context = null)
function __get($name)
function to($name)
function in($name)
function emit($ev)localzet\SocketIO\Engine\Engine
Section titled “localzet\SocketIO\Engine\Engine”function __construct($opts = [])
function __destruct()
function handleRequest(object $req, object $res)
function dealRequest($err, bool $success, object $req)
function checkRequest(object $req, object $res, callable $fn)
function handshake(string $transport, object $req)
function onSocketClose($id): void
function attach($worker): void
function onConnect(object $connection): void
function onWebSocketConnect($connection, object $req, object $res): void
function dealWebSocketConnect($err, bool $success, object $req, object $res): voidlocalzet\SocketIO\Engine\Parser
Section titled “localzet\SocketIO\Engine\Parser”function __construct()
static function encodePacket($packet): string
static function decodePacket(string $data): array
static function decodeBase64Packet($msg): array
static function encodePayload($packets, $supportsBinary = null): string
static function encodeOne($packet): string
static function decodePayload($data, $binaryType = null)
static function encodePayloadAsBinary($packets): string
static function encodeOneAsBinary($p): string
static function decodePayloadAsBinary($data, $binaryType = null): arraylocalzet\SocketIO\Engine\Protocols\Http\Request
Section titled “localzet\SocketIO\Engine\Protocols\Http\Request”src/Engine/Protocols/Http/Request.php
function __construct($connection, $raw_head)
function parseHead($raw_head)
function destroy()localzet\SocketIO\Engine\Protocols\Http\Response
Section titled “localzet\SocketIO\Engine\Protocols\Http\Response”src/Engine/Protocols/Http/Response.php
function __construct($connection)
function writeHead($status_code, $reason_phrase = '', $headers = null)
function getHeadBuffer(): string
function setHeader($key, $val)
function getHeader($name)
function removeHeader($name)
function write($chunk)
function end($data = null)
function destroy()localzet\SocketIO\Engine\Protocols\SocketIO
Section titled “localzet\SocketIO\Engine\Protocols\SocketIO”src/Engine/Protocols/SocketIO.php
static function input($http_buffer, $connection)
static function onData($connection, $data)
static function emitClose($connection)
static function cleanup($connection)
static function emitData($connection, $req, $data)
static function emitEnd($connection, $req)
static function encode($buffer, $connection)
static function decode($http_buffer, $connection)localzet\SocketIO\Engine\Protocols\WebSocket
Section titled “localzet\SocketIO\Engine\Protocols\WebSocket”src/Engine/Protocols/WebSocket.php
static function input($buffer, $connection)
static function dealHandshake($connection, $req, $res)
const MIN_HEAD_LENlocalzet\SocketIO\Engine\Protocols\WebSocket\RFC6455
Section titled “localzet\SocketIO\Engine\Protocols\WebSocket\RFC6455”src/Engine/Protocols/WebSocket/RFC6455.php
static function input(string $buffer, ConnectionInterface $connection): int
static function encode(mixed $buffer, ConnectionInterface $connection): string
static function decode(string $buffer, ConnectionInterface $connection): mixed
static function dealHandshake($connection, $req, $res)
const MIN_HEAD_LEN
const BINARY_TYPE_BLOB
const BINARY_TYPE_ARRAYBUFFERlocalzet\SocketIO\Engine\Socket
Section titled “localzet\SocketIO\Engine\Socket”function __construct($id, $server, $transport, $req)
function __destruct()
function maybeUpgrade(object $transport): void
function onUpgradePacket(array $packet): void
function upgradeCleanup(): void
function onUpgradeTransportClose(): void
function onUpgradeTransportError($err): void
function upgradeTimeoutCallback(object $transport): void
function setTransport(object $transport)
function onOpen(): void
function onPacket(array $packet)
function check(): void
function onError($err): void
function setPingTimeout(): void
function pingTimeoutCallback(): void
function clearTransport(): void
function onClose(string $reason = '', ?string $description = null): void
function send($data, $options, ?callable $callback): Socket
function write($data, ?array $options = [], ?callable $callback = null): Socket
function sendPacket(string $type, $data = null, $callback = null): void
function flush(): void
function getAvailableUpgrades(): array
function close(): void
function closeTransport(): void
function setupSendCallback(): void
function onDrainCallback(): voidlocalzet\SocketIO\Engine\Transport
Section titled “localzet\SocketIO\Engine\Transport”function __construct()
function __destruct()
function noop()
function onRequest($req)
function close(?callable $fn = null): void
function onError(string $msg, string $desc = '')
function onPacket($packet): void
function onData($data)
function onClose()
function destroy(): voidlocalzet\SocketIO\Engine\Transports\Polling
Section titled “localzet\SocketIO\Engine\Transports\Polling”src/Engine/Transports/Polling.php
function onRequest($req)
function onPollRequest(object $req, object $res): void
function pollRequestOnClose(): void
function pollRequestClean(): void
function onDataRequest($req, $res): void
function dataRequestCleanup(): void
function dataRequestOnClose(): void
function dataRequestOnData($req, $data): void
function dataRequestOnEnd(): void
function onData($data)
function onClose()
function send($packets): void
function write($data): void
function doClose(callable $fn): voidlocalzet\SocketIO\Engine\Transports\PollingJsonp
Section titled “localzet\SocketIO\Engine\Transports\PollingJsonp”src/Engine/Transports/PollingJsonp.php
function __construct($req)
function __destruct()
function onData($data)
function doWrite($data): void
function headers(array $headers = []): arraylocalzet\SocketIO\Engine\Transports\PollingXHR
Section titled “localzet\SocketIO\Engine\Transports\PollingXHR”src/Engine/Transports/PollingXHR.php
function __construct()
function __destruct()
function onRequest($req)
function doWrite($data)
function headers(object $req, array $headers = []): arraylocalzet\SocketIO\Engine\Transports\WebSocket
Section titled “localzet\SocketIO\Engine\Transports\WebSocket”src/Engine/Transports/WebSocket.php
function __construct($req)
function __destruct()
function onData2($connection, $data): void
function onError2($conection, $code, $msg): void
function send(array $packets): void
function doClose(callable $fn = null): voidlocalzet\SocketIO\Event\Emitter
Section titled “localzet\SocketIO\Event\Emitter”function __construct()
function __destruct()
function on($event_name, $listener): Emitter
function once($event_name, $listener): Emitter
function removeListener($event_name, $listener): Emitter
function removeAllListeners($event_name = null): Emitter
function listeners($event_name): array
function emit($event_name = null)localzet\SocketIO\Nsp
Section titled “localzet\SocketIO\Nsp”function __construct($server, $name)
function __destruct()
function initAdapter()
function to($name): Nsp
function in($name): Nsp
function add($client, $nsp, $fn)
function remove($socket)
function emit($ev = null)
function send(): Nsp
function write()
function clients($fn): Nsp
function compress($compress): Nsplocalzet\SocketIO\Parser\Decoder
Section titled “localzet\SocketIO\Parser\Decoder”function __construct()
function __destruct()
function add($obj): void
function decodeString($str): array
static function error(): arraylocalzet\SocketIO\Parser\Encoder
Section titled “localzet\SocketIO\Parser\Encoder”function __construct()
function __destruct()
function encode($obj): array
static function encodeAsString($obj): stringlocalzet\SocketIO\Parser\Parser
Section titled “localzet\SocketIO\Parser\Parser”const CONNECT
const DISCONNECT
const EVENT
const ACK
const ERROR
const BINARY_EVENT
const BINARY_ACKlocalzet\SocketIO\Socket
Section titled “localzet\SocketIO\Socket”function __construct($nsp, $client)
function __destruct()
function buildHandshake(): array
function __get($name)
function emit($ev = null)
function to($name): Socket
function in($name): Socket
function send(): Socket
function write(): Socket
function packet($packet, $preEncoded = false)
function join($room): Socket
function leave($room): Socket
function leaveAll()
function onconnect()
function onpacket($packet)
function onevent($packet)
function ack($id): Closure
function onack($packet)
function ondisconnect()
function onerror($err)
function onclose($reason)
function error($err)
function disconnect(bool $close = false): Socket
function compress($compress): Socketlocalzet\SocketIO\SocketIO
Section titled “localzet\SocketIO\SocketIO”function __construct($port = null, $opts = [])
function nsp($v = null)
function socket($v = null)
function adapter($v = null)
function origins($v = null)
function attach($srv, $opts = []): SocketIO
function bind($engine): SocketIO
function of($name, $fn = null)
function onConnection($engine_socket): SocketIO
function on()
function in()
function to()
function emit()
function send()
function write()