Comparing version 3.2.4 to 4.0.0
{ | ||
"name": "hubbie", | ||
"version": "3.2.4", | ||
"version": "4.0.0", | ||
"description": "WebSocket manager", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -45,6 +45,6 @@ # Hubbie | ||
localServer.send(eventObj.peerName, 'Welcome!'); | ||
return true; | ||
return Promise.resolve(true); | ||
} else { | ||
console.log('Client rejected'); | ||
return false; | ||
return Promise.resolve(false); | ||
} | ||
@@ -51,0 +51,0 @@ }); |
@@ -13,5 +13,7 @@ 'use strict' | ||
}; | ||
if (msgHandler.onPeer(eventObj)) { | ||
return eventObj.peerName; | ||
} | ||
return msgHandler.onPeer(eventObj).then((verdict) => { | ||
if (verdict) { | ||
return eventObj.peerName; | ||
} | ||
}); | ||
} | ||
@@ -31,14 +33,15 @@ | ||
// because this way we have peerName available here for the addChannel call: | ||
const peerName = checkCreds(httpReq.url, msgHandler); | ||
if (peerName !== undefined) { | ||
msgHandler.addChannel(peerName, ws); | ||
ws.on('message', (msg) => { | ||
msgHandler.onMessage(peerName, msg); | ||
}); | ||
ws.on('close', () => { | ||
msgHandler.removeChannel(peerName); | ||
}); | ||
} else { | ||
ws.close(); | ||
} | ||
checkCreds(httpReq.url, msgHandler).then((peerName) => { | ||
if (peerName !== undefined) { | ||
msgHandler.addChannel(peerName, ws); | ||
ws.on('message', (msg) => { | ||
msgHandler.onMessage(peerName, msg); | ||
}); | ||
ws.on('close', () => { | ||
msgHandler.removeChannel(peerName); | ||
}); | ||
} else { | ||
ws.close(); | ||
} | ||
}); | ||
}); | ||
@@ -45,0 +48,0 @@ return wss; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35597
560