Don't merge messages on client if server sends over 100 of them

This commit is contained in:
Pavel Djundik 2019-01-17 22:35:14 +02:00
parent b066dc301e
commit f3cf69796d

View File

@ -44,7 +44,8 @@ socket.on("init", function(data) {
channel.pendingMessage = currentChannel.pendingMessage; channel.pendingMessage = currentChannel.pendingMessage;
// Reconnection only sends new messages, so merge it on the client // Reconnection only sends new messages, so merge it on the client
if (currentChannel.messages) { // Only concat if server sent us less than 100 messages so we don't introduce gaps
if (currentChannel.messages && channel.messages.length < 100) {
channel.messages = currentChannel.messages.concat(channel.messages); channel.messages = currentChannel.messages.concat(channel.messages);
} }