Improve loading

This commit is contained in:
Cryptkeeper 2015-11-24 00:24:10 -06:00
parent 3eceb05cac
commit 695e70f4c7

5
app.js

@ -101,15 +101,14 @@ server.start(function() {
logger.log('info', 'Accepted connection: %s, total clients: %d', client.request.connection.remoteAddress, connectedClients); logger.log('info', 'Accepted connection: %s, total clients: %d', client.request.connection.remoteAddress, connectedClients);
// Remap our associative array into just an array. // Remap our associative array into just an array.
var networkHistoryList = [];
var networkHistoryKeys = Object.keys(networkHistory); var networkHistoryKeys = Object.keys(networkHistory);
// Send each individually, this should look cleaner than waiting for one big array to transfer.
for (var i = 0; i < networkHistoryKeys.length; i++) { for (var i = 0; i < networkHistoryKeys.length; i++) {
networkHistoryList.push(networkHistory[networkHistoryKeys[i]]); client.emit('add', [networkHistory[networkHistoryKeys[i]]]);
} }
// Send them our previous data, so they have somewhere to start. // Send them our previous data, so they have somewhere to start.
client.emit('add', networkHistoryList);
client.emit('updateMojangServices', mojang.toMessage()); client.emit('updateMojangServices', mojang.toMessage());
// Attach our listeners. // Attach our listeners.