feat(frontend): track the number of messages received / sent

This commit is contained in:
Florent Chehab 2020-05-02 12:59:03 +02:00
parent 6f68f9f21f
commit db89dd819b
No known key found for this signature in database
GPG Key ID: 9A0CE018889EA246
2 changed files with 9 additions and 0 deletions

View File

@ -124,6 +124,10 @@
</div>
</div>
<div style="position: absolute; bottom: 10px; right: 10px;">
<p># msg. sent to server: <i id="messageSentCount">0</i></p>
<p># msg. received from server: <i id="messageReceivedCount">0</i></p>
</div>
</body>
</html>

View File

@ -43,8 +43,10 @@ function main() {
signaling_socket.on('connect', function () {
console.log("Websocket connected!");
let messageReceivedCount = 0;
signaling_socket.on('drawToWhiteboard', function (content) {
whiteboard.handleEventsAndData(content, true);
$('#messageReceivedCount')[0].innerText = String(messageReceivedCount++);
});
signaling_socket.on('refreshUserBadges', function () {
@ -69,12 +71,15 @@ function main() {
if (getQueryVariable("webdav") == "true") {
$("#uploadWebDavBtn").show();
}
let messageSentCount = 0;
whiteboard.loadWhiteboard("#whiteboardContainer", { //Load the whiteboard
whiteboardId: whiteboardId,
username: btoa(myUsername),
sendFunction: function (content) {
content["at"] = accessToken;
signaling_socket.emit('drawToWhiteboard', content);
$('#messageSentCount')[0].innerText = String(messageSentCount++);
}
});