Swoole\WebSocket\Server->unpack

Declaration

<?php
Swoole\WebSocket\Server->unpack (string $data, int $opcode = 1, bool $finish = true, bool $mask = false)

Parameters

Return

Description

Unpack data from a WebSocket Frame.

WebSocket Frame OpCode

  • WEBSOCKET_OPCODE_TEXT = 1 : string
  • WEBSOCKET_OPCODE_BINARY = 2 : binary
  • WEBSOCKET_OPCODE_PING = 3 : ping

    Example