1
사용자 (앱)에서 관리자 (브라우저)로 채팅하려면 socket.io를 사용하고 있습니다. 여기서 admin msg는 사용자에게 제대로 수신되었지만 관리자가 수신하지 않은 사용자 메시지입니다. 채팅 응용 프로그램에 대해 https://www.sitepoint.com/using-socket-io-and-cordova-to-create-a-real-time-chat-app/을 팔로우하고 있습니다. 또한 App to App 채팅 기능이있어 잘 작동합니다. 여기 socket.io 앱과 웹 채팅
내 서버 측 코드
socket.on('send:message', function (msg) {
console.log("send:message", msg);
if (msg.orderChat) var q = models.orderChat.create(msg)
else var q = models.chat.create(msg)
q.then(function (ret) {
console.log(ret.get({ plain: true }));
socket.in(msg.chat_room).emit('send:message', msg);
//socket.emit('send:message', msg);
}).catch(function (err) {
console.log(err);
socket.in(msg.chat_room).emit('send:message', 'Server Error');
});
});
여기
내 클라이언트 측 코드
socket.on('send:message', function (msg) {
username = $('.pchat').attr('data-username');
console.log(msg);
$("#chat_div_" + username).chatbox("option", "boxManager").addMsg(username, msg.message);
})
갱신 또한 코드가 잘 작동 할 때 동일한 찾아보기에서 사용자 채팅하지만, 십자가 탐색에 포함되지 않음