improve method name

This commit is contained in:
freek 2018-12-01 13:40:18 +01:00
parent 8648a182b3
commit 0bff2f9f14
1 changed files with 13 additions and 11 deletions

View File

@ -28,8 +28,8 @@ class WebSocketHandler implements MessageComponentInterface
public function onOpen(ConnectionInterface $connection)
{
$this
->verifyAppKey($connection)
->generateSocketId($connection)
->verifyConnection($connection)
->establishConnection($connection);
}
@ -54,16 +54,7 @@ class WebSocketHandler implements MessageComponentInterface
}
}
protected function generateSocketId(ConnectionInterface $connection)
{
$socketId = sprintf("%d.%d", random_int(1, 1000000000), random_int(1, 1000000000));
$connection->socketId = $socketId;
return $this;
}
protected function verifyConnection(ConnectionInterface $connection)
protected function verifyAppKey(ConnectionInterface $connection)
{
$appKey = QueryParameters::create($connection->httpRequest)->get('appKey');
@ -76,6 +67,17 @@ class WebSocketHandler implements MessageComponentInterface
return $this;
}
protected function generateSocketId(ConnectionInterface $connection)
{
$socketId = sprintf("%d.%d", random_int(1, 1000000000), random_int(1, 1000000000));
$connection->socketId = $socketId;
return $this;
}
protected function establishConnection(ConnectionInterface $connection)
{
$connection->send(json_encode([