Skip to content

Commit

Permalink
fix broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
manix committed May 31, 2019
1 parent dd04c60 commit d32c4a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "websocket-base",
"version": "4.0.0",
"version": "4.0.1",
"description": "A websocket server foundation.",
"main": "src/server.js",
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions src/store-events.js
Expand Up @@ -4,9 +4,10 @@ module.exports = function (store) {
let base = require("./server");

store.subscribe("/base/broadcast", function (message) {
for (let user of base.users.all()) {
user.send(message);
}
let users = base.users.all();
Object.keys(users).forEach(key => {
users[key].send(message);
});
});

store.subscribe("/base/conn-open", function (message) {
Expand Down

0 comments on commit d32c4a0

Please sign in to comment.