Swoole\WebSocket\Server->getClientInfo

Declaration

<?php
Swoole\WebSocket\Server->getClientInfo (int $fd)

Parameters

fd

The fd of the WebSocket connection, it can be get from the frame.

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

Get the TCP connection info.

Get WebSocket Connection Status

You can get the websocket connection status websocket_status with function $server->getClientInfo($fd):

  • WEBSOCKET_STATUS_CONNECTION = 1, connection created and wait for handshake
  • WEBSOCKET_STATUS_HANDSHAKE = 2, in the process of handshake
  • WEBSOCKET_STATUS_FRAME = 3, handshake finished and wait for tranforming message

Example