-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #benchmark: Add Benchmark for send() * #benchmark: Add Benchmark for send()
- Loading branch information
1 parent
46e9295
commit f9b884d
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace WSSCTEST\Benchmark; | ||
|
||
require_once __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Exception; | ||
use WSSC\Components\ClientConfig; | ||
use WSSC\WebSocketClient; | ||
|
||
class MaxConnectionsBench | ||
{ | ||
private const WS_SCHEME = 'ws://'; | ||
private const WS_HOST = 'localhost'; | ||
private const WS_PORT = ':8000'; | ||
private const WS_URI = '/notifications/messanger/vkjsndfvjn23243'; | ||
|
||
private string $url = self::WS_SCHEME . self::WS_HOST . self::WS_PORT . self::WS_URI; | ||
private WebSocketClient $client; | ||
|
||
/** | ||
* @throws \WSSC\Exceptions\BadUriException | ||
* @throws \WSSC\Exceptions\ConnectionException | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->client = new WebSocketClient($this->url, new ClientConfig()); | ||
} | ||
|
||
/** | ||
* @Revs(10000) | ||
* @Iterations(3) | ||
* @throws Exception | ||
*/ | ||
public function benchConnect(): void | ||
{ | ||
$this->client->send('{"user_id" : 123}'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters