Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chipslays committed Jan 16, 2024
1 parent 1628798 commit e13a69a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/Events/Bus.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@ public function getAll(): array

return call_user_func_array('array_merge', $events);
}

/**
* Clear all events.
*
* @return self
*/
public function clear(): self
{
$this->events = [];

return $this;
}
}
16 changes: 13 additions & 3 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ public function __construct(string $ip, int $port, array $context = [], int $pro
protected function createWorkerInstance(string $ip, int $port, array $context = [], int $processes = 1): void
{
$this->worker = new Worker('websocket://' . $ip . ':' . $port, $context);

$this->worker->count = $processes;

$this->worker->name = 'Server-' . date('d-m-Y_H-i-s');
}

Expand All @@ -72,14 +70,26 @@ public function setWorker(Worker $worker): self
return $this;
}

/**
* Gets a event bus.
*
* @return EventBus
*/
public function getEventBus(): EventBus
{
return $this->eventBus;
}

/**
* The callback function triggered when the client establishes
* a connection with Workerman (after the TCP three-way handshake is completed).
*
* The callback will only be triggered once per connection.
*
* Event only represents that the client and Workerman have completed
* the TCP three-way handshake. At this time, the client has not sent any data.
* the TCP three-way handshake.
*
* At this time, the client has not sent any data.
*
* @see https://www.workerman.net/doc/workerman/worker/on-connect.html
*
Expand Down

0 comments on commit e13a69a

Please sign in to comment.