This repository was archived by the owner on Jun 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -4,23 +4,34 @@ namespace {{ namespace }};
44
55use Workerman\Timer;
66use Workerman\Worker;
7+ use Workerman\Connection\TcpConnection;
78
89class {{ class }}
910{
10- public function onWorkerStart($connection)
11+ public function onWorkerStart(TcpConnection $connection)
1112 {
13+ var_dump('worker start' . $connection->id);
1214 }
1315
14- public function onWorkerStop($connection)
16+ public function onWorkerStop(TcpConnection $connection)
1517 {
18+ var_dump('worker start' . $connection->id);
1619 }
17-
18- public function onConnect($connection)
20+
21+ public function onConnect(TcpConnection $connection)
1922 {
23+ var_dump('client connect to connection_id ' . $connection->id);
24+ }
25+
26+ public function onMessage(TcpConnection $connection, $data)
27+ {
28+ var_dump($message = "connection id {$connection->id} receive message from client: " . $data);
29+
30+ $connection->send($message);
2031 }
2132
22- public function onClose($connection)
33+ public function onClose(TcpConnection $connection)
2334 {
2435 $connection->close();
2536 }
26- }
37+ }
You can’t perform that action at this time.
0 commit comments