ws_state()


Getting current TCP state of the designated websocket TCP session

Description

int ws_state(int $tcp_id)

Parameters

Return Value

integer number indicating TCP session state (TCP_CLOSED, TCP_CONNECTED or 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");
while(ws_state(0) != TCP_CONNECTED)
  ;
echo "Web Socket connected!\r\n";
?>

See also