Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 761fc4b

Browse files
authored
Merge pull request #29 from mouyong/master
Update CustomProcess.stub
2 parents 1d5c822 + 7c8e830 commit 761fc4b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/Commands/stubs/CustomProcess.stub

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,34 @@ namespace {{ namespace }};
44

55
use Workerman\Timer;
66
use Workerman\Worker;
7+
use Workerman\Connection\TcpConnection;
78

89
class {{ 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+
}

0 commit comments

Comments
 (0)