does anyone know how to avoid WebSocket\ConnectionException from a receive_fragment error? I send a json through a websocket and added a while to receive the response, but it seems that I only get a fragment of it and throws a error afterwards. {"protocol":"UNKNOWN"," ["class"]=> string(14) "WebSocket\Base" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> int(2) } } [1]=> array(6) { ["file"]=> string(84) "textalk\stocks\vendor\textalk\websocket\lib\Base.php" ["line"]=> int(135) ["function"]=> string(16) "receive_fragment" ["class"]=> string(14) "WebSocket\Base" ["type"]=> string(2) "->" ["args"]=> array(0) { } } [2]=> array(6) { ["file"]=> string(61) "F:\xampp-php72\htdocs\testcodes\textalk\stocks\dailyorder.php" ["line"]=> int(51) ["function"]=> string(7) "receive" ["class"]=> string(14) "WebSocket\Base" ["type"]=> string(2) "->" ["args"]=> array(0) { } } } ["previous":"Exception":private]=> NULL } object(WebSocket\ConnectionException)#7 (7) {"Empty read; connection dead? The Code : $client->send( json_encode($dailyOrder) ); while (true) { try { $dailyorder = json_decode( $client->receive() ); var_dump($dailyorder); } catch (\WebSocket\ConnectionException $e) { var_dump($e); } If anyone has any idea it would really help!
json_decode
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)