|
|
@@ -97,6 +97,8 @@ class Socket extends Command
|
|
|
public function message($ws, $frame)
|
|
|
{
|
|
|
try{
|
|
|
+
|
|
|
+ var_dump($frame->data);
|
|
|
if ($frame->data == 'ping') {
|
|
|
$this->ws->push($frame->fd, 'pong');
|
|
|
return false;
|
|
|
@@ -104,6 +106,7 @@ class Socket extends Command
|
|
|
|
|
|
// 消息处理
|
|
|
$data = $frame->data ? json_decode($frame->data, true) : [];
|
|
|
+
|
|
|
$op = isset($data['op']) ? $data['op'] : '';
|
|
|
$userId = isset($data['from_uid'])? intval($data['from_uid']) : 0;
|
|
|
$chatKey = isset($data['chat_key'])? trim($data['chat_key']) : '';
|
|
|
@@ -152,7 +155,6 @@ class Socket extends Command
|
|
|
|
|
|
$this->ws->push($frame->fd, json_encode($data, 256));
|
|
|
$toBindData = RedisService::get("chats:bind:{$toUid}");
|
|
|
- var_dump($toBindData);
|
|
|
$toFd = isset($toBindData['fd']) ? $toBindData['fd'] : 0;
|
|
|
$toChatKey = isset($toBindData['chat_key']) ? $toBindData['chat_key'] : '';
|
|
|
if ($toBindData && $toFd && $toChatKey == $chatKey) {
|
|
|
@@ -161,6 +163,8 @@ class Socket extends Command
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ $this->ws->push($frame->fd, json_encode(['message'=> $frame->data], 256));
|
|
|
} else {
|
|
|
$this->ws->push($frame->fd, json_encode(['message'=>'no data'], 256));
|
|
|
}
|