Skip to content

Commit

Permalink
Make sure server is running before loading users
Browse files Browse the repository at this point in the history
  • Loading branch information
astorije committed Aug 23, 2017
1 parent aa49856 commit 684f1a6
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,32 @@ module.exports = function() {
}, () => {
const protocol = config.https.enable ? "https" : "http";
var address = server.address();
log.info(`Available on ${colors.green(protocol + "://" + address.address + ":" + address.port + "/")} \
in ${config.public ? "public" : "private"} mode`);
});

var sockets = io(server, {
serveClient: false,
transports: config.transports
});
log.info(
"Available at " +
colors.green(`${protocol}://${address.address}:${address.port}/`) +
` in ${colors.bold(config.public ? "public" : "private")} mode`
);

sockets.on("connect", function(socket) {
if (config.public) {
performAuthentication.call(socket, {});
} else {
socket.emit("auth", {success: true});
socket.on("auth", performAuthentication);
}
});
const sockets = io(server, {
serveClient: false,
transports: config.transports
});

manager = new ClientManager();
sockets.on("connect", (socket) => {
if (config.public) {
performAuthentication.call(socket, {});
} else {
socket.emit("auth", {success: true});
socket.on("auth", performAuthentication);
}
});

new Identification((identHandler) => {
manager.init(identHandler, sockets);
manager = new ClientManager();

new Identification((identHandler) => {
manager.init(identHandler, sockets);
});
});
};

Expand Down

0 comments on commit 684f1a6

Please sign in to comment.