This commit is contained in:
2020-08-31 14:52:28 +08:00
parent df49c40163
commit 8b1bf6c04a
6 changed files with 24 additions and 8 deletions
+4 -1
View File
@@ -57,7 +57,6 @@ return [
],
'message' => [
'pack' => function ($data) {
var_dump($data);
return \Snowflake\Core\JSON::encode($data);
},
'unpack' => function ($data) {
@@ -86,6 +85,9 @@ return [
'receive' => function ($server, int $fd, int $reactorId, string $data) {
$server->push(1, 'success.');
$server->send($fd, 'success.');
$socket = Snowflake::get()->get(\HttpServer\Events\WebSocket::class);
$socket->push(1, 'hello word~~~~~~~~~~~~~');
},
'settings' => []
],
@@ -103,6 +105,7 @@ return [
},
Event::SERVER_MESSAGE => function (\Swoole\WebSocket\Server $server, Frame $frame) {
$this->error('websocket SERVER_MESSAGE.');
return $server->push($frame->fd, 'hello word~');
},
Event::SERVER_CLOSE => function (int $fd) {