Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix namespace for analyzing if an fd is a websocket payload in onClos…
…e event
  • Loading branch information
albertcht committed Mar 9, 2019
commit 06ad668b7fadf4f5b0b5969665fc1b632b726a1d
5 changes: 3 additions & 2 deletions src/Concerns/InteractsWithWebsocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SwooleTW\Http\Server\Facades\Server;
use SwooleTW\Http\Websocket\HandlerContract;
use Illuminate\Contracts\Container\Container;
use Swoole\WebSocket\Server as WebsocketServer;
use SwooleTW\Http\Websocket\Rooms\RoomContract;
use SwooleTW\Http\Exceptions\WebsocketNotSetInConfigException;

Expand Down Expand Up @@ -129,7 +130,7 @@ public function onMessage($server, $frame)
*/
public function onClose($server, $fd, $reactorId)
{
if (! $this->isServerWebsocket($fd) || ! $server instanceof Websocket) {
if (! $this->isServerWebsocket($fd) || ! $server instanceof WebsocketServer) {
return;
}

Expand Down Expand Up @@ -229,7 +230,7 @@ protected function prepareWebsocket()
*/
protected function isServerWebsocket(int $fd): bool
{
return $this->container->make(Server::class)
return (bool) $this->container->make(Server::class)
->connection_info($fd)['websocket_status'] ?? false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Websocket/Pusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public function shouldBroadcast(): bool
*/
public function isServerWebsocket(int $fd): bool
{
return $this->server->connection_info($fd)['websocket_status'] ?? false;
return (bool) $this->server->connection_info($fd)['websocket_status'] ?? false;
}

/**
Expand Down