public function testRandomInt()
 {
     /**
      * Message returned by WebSocket server is string
      */
     $txt = (string) rand(10, 1000);
     $ws = new Client("ws://{$GLOBALS["ip"]}:{$GLOBALS["port"]}/?service=hello");
     $ws->send($txt);
     $this->assertEquals($txt, $ws->receive());
     $ws->close();
 }
<?php

require dirname(__DIR__) . '/vendor/autoload.php';
use WebSocket\Client;
$client = new Client("ws://85.214.151.129:8080");
$client->send("[{INSERT\\/\\/CLICK\\/\\/COORDINATES}]");
$client->close();
sleep(60);
$client = new Client("ws://85.214.151.129:8080");
$client->send("[{INSERT\\/\\/MOUSEMOVE\\/\\/COORDINATES}]");
$client->close();
sleep(60);
$client = new Client("ws://85.214.151.129:8080");
$client->send("[{INSERT\\/\\/SCROLL\\/\\/COORDINATES}]");
$client->close();
?>

예제 #3
0
 protected function close()
 {
     if ($this->ws->isConnected() && !$this->getOption(JsonRpc::OPTION_PERSISTENT, false)) {
         $this->ws->close();
     }
 }