...
|
...
|
@@ -583,6 +583,11 @@ function pageInit() { |
|
|
* 连接socket
|
|
|
*/
|
|
|
function connectSocket() {
|
|
|
|
|
|
// 获取上次会话id
|
|
|
var lastSessionId = window.cookie('sessionId');
|
|
|
|
|
|
originConf.conversationMessage.sessionId = lastSessionId || 0;
|
|
|
socketChat.init(Object.assign(originConf, {
|
|
|
onMessage: function onMessage(e) {
|
|
|
var jsonString = e.data;
|
...
|
...
|
@@ -590,9 +595,15 @@ function pageInit() { |
|
|
|
|
|
socketConfCM.conversationId = received.newConversationId !== 0 ? received.newConversationId : received.conversationId;
|
|
|
|
|
|
// 保存会话id
|
|
|
window.setCookie('conversationId', socketConfCM.conversationId, {expires: 60 * 15});
|
|
|
window.setCookie('sessionId', received.sessionId, {expires: 60 * 15});
|
|
|
getMessage(received);
|
|
|
},
|
|
|
|
|
|
onOpen: function onClose(e) {
|
|
|
},
|
|
|
|
|
|
onClose: function onClose() {
|
|
|
$('.connect-fail').fadeIn();
|
|
|
},
|
...
|
...
|
|