初始化

main
gzydong 2020-11-30 22:59:49 +08:00
parent 84b9900f7d
commit b14120a636
2 changed files with 7 additions and 6 deletions

View File

@ -247,7 +247,7 @@ class ChatMessageConsumer extends ConsumerMessage
unset($result, $file, $code_block, $forward, $invite); unset($result, $file, $code_block, $forward, $invite);
$server = websocket(); $server = server();
$notify = json_encode(['event_talk', $msg]); $notify = json_encode(['event_talk', $msg]);
foreach ($fds as $fd) { foreach ($fds as $fd) {
$server->exist($fd) && $server->push($fd, $notify); $server->exist($fd) && $server->push($fd, $notify);
@ -266,7 +266,7 @@ class ChatMessageConsumer extends ConsumerMessage
public function onConsumeKeyboard(array $data, AMQPMessage $message) public function onConsumeKeyboard(array $data, AMQPMessage $message)
{ {
$fds = $this->socketClientService->findUserFds($data['data']['receive_user']); $fds = $this->socketClientService->findUserFds($data['data']['receive_user']);
$server = websocket(); $server = server();
$notify = json_encode(['event_keyboard', $data['data']]); $notify = json_encode(['event_keyboard', $data['data']]);
foreach ($fds as $fd) { foreach ($fds as $fd) {
$server->exist($fd) && $server->push($fd, $notify); $server->exist($fd) && $server->push($fd, $notify);
@ -293,7 +293,7 @@ class ChatMessageConsumer extends ConsumerMessage
} }
$fds = array_unique($fds); $fds = array_unique($fds);
$server = websocket(); $server = server();
$notify = json_encode(['event_online_status', $data['data']]); $notify = json_encode(['event_online_status', $data['data']]);
foreach ($fds as $fd) { foreach ($fds as $fd) {
$server->exist($fd) && $server->push($fd, $notify); $server->exist($fd) && $server->push($fd, $notify);
@ -326,7 +326,7 @@ class ChatMessageConsumer extends ConsumerMessage
} }
$fds = array_unique($fds); $fds = array_unique($fds);
$server = websocket(); $server = server();
$notify = json_encode(['event_revoke_talk', [ $notify = json_encode(['event_revoke_talk', [
'record_id' => $record->id, 'record_id' => $record->id,
'source' => $record->source, 'source' => $record->source,
@ -353,7 +353,7 @@ class ChatMessageConsumer extends ConsumerMessage
$fds = $this->socketClientService->findUserFds($data['data']['receive']); $fds = $this->socketClientService->findUserFds($data['data']['receive']);
$fds = array_unique($fds); $fds = array_unique($fds);
$server = websocket(); $server = server();
$notify = json_encode(['event_friend_apply', $data['data']]); $notify = json_encode(['event_friend_apply', $data['data']]);
foreach ($fds as $fd) { foreach ($fds as $fd) {
$server->exist($fd) && $server->push($fd, $notify); $server->exist($fd) && $server->push($fd, $notify);

View File

@ -34,7 +34,8 @@
"phper666/jwt-auth": "^3.0", "phper666/jwt-auth": "^3.0",
"hyperf/filesystem": "^2.0", "hyperf/filesystem": "^2.0",
"hyperf/socketio-server": "^2.0", "hyperf/socketio-server": "^2.0",
"hashids/hashids": "^4.0" "hashids/hashids": "^4.0",
"ext-json": "^1.6"
}, },
"require-dev": { "require-dev": {
"swoole/ide-helper": "^4.5", "swoole/ide-helper": "^4.5",