ws_state()


返还websocket session的状态

Description

int ws_state(int $tcp_id)

Parameters

Return Value

体现TCP session状态的整数值(TCP_CLOSED, TCP_CONNECTED 或TCP_LISTEN)

Example

<?php
include "/lib/sn_tcp_ws.php";
// configuring a websocket and waiting for a connection
ws_setup(0, "my_path", "my_proto");
$rbuf = "";
while(ws_state(0) != TCP_CONNECTED)
  ;
echo "Web Socket connected!\r\n";
?>

See also