返回的信息來判斷是否推送成功,來達到離線目的;目前這個推送是否成功怎么判斷
你好,問下我用web-msg-sender項目,看了他們的DEMO,不知道在哪個方法接收到返回消息的例子
$inner_http_worker->onMessage = function($http_connection, $data){
global $uidConnectionMap;
global $sender_io;
$sender_io->emit('new_msg', $_POST);
// http接口返回,如果用戶離線socket返回fail
if($to && !isset($uidConnectionMap)){
return $http_connection->send('offline');
}else{
return $http_connection->send('ok');
}
return $http_connection->send('fail');
};
// 執(zhí)行監(jiān)聽
$inner_http_worker->listen();
uidConnectionMap用這個來判斷在線、離線太簡陋了,IOS系統(tǒng)無法實現(xiàn),
目前我想用發(fā)送成功還是失敗來判斷是否是離線還是在線
https://github.com/walkor/phpsocket.io/tree/master/docs/zh
接收消息參考手冊,自定義一個消息,然后客戶端emit這個消息
你好,客戶端通過emit這個方法,返回給服務(wù)器么,那服務(wù)器端在哪里接收這個狀態(tài)信息
<script>
// 連接服務(wù)端
var socket = io('http://127.0.0.1:3120');
// 觸發(fā)服務(wù)端的chat message事件
socket.emit('chat message', '這個是消息內(nèi)容...');