Skip to content
Snippets Groups Projects
Commit f1387cef authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #442 Do not broadcast a block on each new connection to the websocket

parent 4e38c122
No related branches found
No related tags found
No related merge requests found
...@@ -93,8 +93,9 @@ module.exports = function(server, interfaces, httpLogs) { ...@@ -93,8 +93,9 @@ module.exports = function(server, interfaces, httpLogs) {
wssBlock.on('connection', function connection(ws) { wssBlock.on('connection', function connection(ws) {
co(function *() { co(function *() {
currentBlock = yield server.dal.getCurrent(); currentBlock = yield server.dal.getCurrent();
wssBlock.broadcast(JSON.stringify(sanitize(currentBlock, dtos.Block))); if (currentBlock) {
ws.send(JSON.stringify(sanitize(currentBlock, dtos.Block))); ws.send(JSON.stringify(sanitize(currentBlock, dtos.Block)));
}
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment