diff --git a/build/kwebsocket/core/wsinterop.php b/build/kwebsocket/core/wsinterop.php index c3224ff..5eaf3d0 100644 --- a/build/kwebsocket/core/wsinterop.php +++ b/build/kwebsocket/core/wsinterop.php @@ -35,7 +35,10 @@ } public function receive() : array{ - $size = unpack("N",socket_read($this->socket,4))[1]; + $size = 0; + while($size == 0){ + $size = unpack("N",socket_read($this->socket,4))[1]; + } $read = 0; $data = ""; $tmp = ""; @@ -51,4 +54,9 @@ return json_decode($data,true); } + public function close(){ + socket_shutdown($this->socket); + socket_close($this->socket); + } + } \ No newline at end of file diff --git a/build/router/controller/page.php b/build/router/controller/page.php index a4963b0..00339d2 100755 --- a/build/router/controller/page.php +++ b/build/router/controller/page.php @@ -60,6 +60,7 @@ $_SESSION['NAME'] = $check['name']; } + $wsi->close(); $wsi = null; }