Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCommunication
chat_webview
Commits
bc5339ae
Commit
bc5339ae
authored
Aug 02, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'squash/socket_kim-ec' into 'develop'
Squash/socket kim ec See merge request
!217
parents
9868ee7e
cc0c6e1f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
4 deletions
+34
-4
public_new/js/common/constant.js
+1
-1
public_new/js/sockets/chat-websocket-message.js
+2
-2
public_new/js/sockets/chat-websocket.js
+31
-1
No files found.
public_new/js/common/constant.js
View file @
bc5339ae
...
@@ -142,7 +142,7 @@ const SOCKET_KEY = {
...
@@ -142,7 +142,7 @@ const SOCKET_KEY = {
CREATE_TEXT
:
"createText"
,
CREATE_TEXT
:
"createText"
,
CREATE_IMAGE
:
"createImage"
,
CREATE_IMAGE
:
"createImage"
,
CREATE_VIDEO
:
"createVideo"
,
CREATE_VIDEO
:
"createVideo"
,
C
REATE_COMMUNICATIONSTART
:
"createCommunicationStart
"
,
C
OMMUNICATION
:
"communication
"
,
GET_GROUP_LIST
:
"getGroupList"
,
GET_GROUP_LIST
:
"getGroupList"
,
LEAVE_ROOM
:
"leaveRoom"
,
LEAVE_ROOM
:
"leaveRoom"
,
};
};
...
...
public_new/js/sockets/chat-websocket-message.js
View file @
bc5339ae
...
@@ -2,11 +2,11 @@ CHAT_SOCKET.bindOnNewMessage = function () {
...
@@ -2,11 +2,11 @@ CHAT_SOCKET.bindOnNewMessage = function () {
// New Message
// New Message
// #36170
// #36170
socket
.
on
(
SOCKET_KEY
.
NEW_MESSAGE
,
function
(
message
,
roomID
,
roomName
)
{
socket
.
on
(
SOCKET_KEY
.
NEW_MESSAGE
,
function
(
message
,
roomID
,
roomName
)
{
handleMessage
(
message
,
roomName
,
SOCKET_KEY
.
NEW_MESSAGE
)
CHAT_SOCKET
.
handleMessage
(
message
,
roomName
,
SOCKET_KEY
.
NEW_MESSAGE
)
});
});
socket
.
on
(
SOCKET_KEY
.
NEW_COMMUNICATION
,
function
(
message
,
roomID
,
roomName
)
{
socket
.
on
(
SOCKET_KEY
.
NEW_COMMUNICATION
,
function
(
message
,
roomID
,
roomName
)
{
handleMessage
(
message
,
roomName
,
SOCKET_KEY
.
NEW_COMMUNICATION
)
CHAT_SOCKET
.
handleMessage
(
message
,
roomName
,
SOCKET_KEY
.
NEW_COMMUNICATION
)
});
});
};
};
...
...
public_new/js/sockets/chat-websocket.js
View file @
bc5339ae
...
@@ -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
)
{
socket
.
emit
(
SOCKET_KEY
.
CREATE_COMMUNICATIONSTART
,
{
text
:
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
);
}
};
};
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment