Commit 996f5f2c by Kim Peace

Merge branch 'squash/socket_43367' into 'squash/socket_kim-ec'

#43367 【ABook Communication】チャット画面を10分間放置するとセッションが切れる

See merge request !214
parents 74b89250 d495eeda
...@@ -188,8 +188,17 @@ var bindOnRefreshUserListInGroup = function () { ...@@ -188,8 +188,17 @@ var bindOnRefreshUserListInGroup = function () {
); );
}; };
var nextFibonacci = function (num) {
let nextNum = num * (1 + Math.sqrt(5)) / 2.0;
return Math.round(nextNum);
}
CHAT_SOCKET.emitCreateMessage = function (socketKey, sendData) { CHAT_SOCKET.emitCreateMessage = function (socketKey, sendData) {
if (socket.connected == false) {
CHAT_SOCKET.reconnectCreateMessage(socketKey, sendData);
} else {
socket.emit(socketKey, { text: sendData }); socket.emit(socketKey, { text: sendData });
}
}; };
CHAT_SOCKET.emitCreateText = function (sendData) { CHAT_SOCKET.emitCreateText = function (sendData) {
...@@ -205,9 +214,30 @@ CHAT_SOCKET.emitCreateVideo = function (sendData) { ...@@ -205,9 +214,30 @@ CHAT_SOCKET.emitCreateVideo = function (sendData) {
}; };
CHAT_SOCKET.emitCreateCommunicationStart = function (sendData, collaborationType, meetingID) { CHAT_SOCKET.emitCreateCommunicationStart = function (sendData, collaborationType, meetingID) {
if (socket.connected == false) {
CHAT_SOCKET.reconnectCreateMessage(SOCKET_KEY.COMMUNICATION, sendData, collaborationType, meetingID);
} else {
socket.emit(SOCKET_KEY.COMMUNICATION, { text: sendData }, collaborationType, meetingID); socket.emit(SOCKET_KEY.COMMUNICATION, { text: sendData }, collaborationType, meetingID);
}
}; };
CHAT_SOCKET.reconnectCreateMessage = function (socketKey, sendData, timeout = 100, collaborationType = null, meetingID = null) {
if (socket.connected == false) {
console.log("socket disconnected, reconnect... " + timeout)
CHAT_SOCKET.initialJoin();
setTimeout(function() {
CHAT_SOCKET.reconnectCreateMessage(socketKey, sendData, nextFibonacci(timeout));
}, timeout);
} else {
console.log("reconnected")
if (collaborationType == null) {
socket.emit(socketKey, { text: sendData });
} else {
socket.emit(socketKey, { text: sendData }, collaborationType, meetingID);
}
}
}
CHAT_SOCKET.emitCollaborationFinishMessage = function () { CHAT_SOCKET.emitCollaborationFinishMessage = function () {
if (socket != null && socket.connected) { if (socket != null && socket.connected) {
const sendData = DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL; const sendData = DATA_MESSAGE_SCHEME + FINISH_ALL_COLLABORATION_SIGNAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment