Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 22.x
pecl install openswoole-22.0.0
The fd of the WebSocket connection
If success, it returns , otherwise it returns
Get the TCP connection info.
An array is returned if the
$fd is correct.
You can get the WebSocket connection status (constants) from
websocket_status with function
WEBSOCKET_STATUS_CONNECTION= 1, connection created and wait for handshake
WEBSOCKET_STATUS_HANDSHAKE= 2, in the process of WebSocket handshake validation
WEBSOCKET_STATUS_ACTIVE= 3 (renamed from
WEBSOCKET_STATUS_FRAME), handshake finished and waiting for transforming/browser message
WEBSOCKET_STATUS_CLOSING= 4, the connection is undergoing a closing handshake and will be closed soon