Remove isRegistered
This commit is contained in:
parent
f8e53d5f72
commit
b10962f13f
@ -102,10 +102,6 @@ function Client(manager, name, config = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
Client.prototype.isRegistered = function() {
|
||||
return this.name.length > 0;
|
||||
};
|
||||
|
||||
Client.prototype.emit = function(event, data) {
|
||||
if (this.sockets !== null) {
|
||||
this.sockets.in(this.id).emit(event, data);
|
||||
|
@ -401,8 +401,9 @@ function initializeClient(socket, client, token, lastMessage) {
|
||||
}
|
||||
});
|
||||
|
||||
if (!Helper.config.public) {
|
||||
socket.on("push:register", (subscription) => {
|
||||
if (!client.isRegistered() || !client.config.sessions.hasOwnProperty(token)) {
|
||||
if (!client.config.sessions.hasOwnProperty(token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -418,14 +419,9 @@ function initializeClient(socket, client, token, lastMessage) {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("push:unregister", () => {
|
||||
if (!client.isRegistered()) {
|
||||
return;
|
||||
socket.on("push:unregister", () => client.unregisterPushSubscription(token));
|
||||
}
|
||||
|
||||
client.unregisterPushSubscription(token);
|
||||
});
|
||||
|
||||
const sendSessionList = () => {
|
||||
const sessions = _.map(client.config.sessions, (session, sessionToken) => ({
|
||||
current: sessionToken === token,
|
||||
|
Loading…
Reference in New Issue
Block a user