Merge pull request #229 from shocknet/socket-authorization

correct non_auth event
This commit is contained in:
Daniel Lugo 2020-10-24 10:29:05 -04:00 committed by GitHub
commit 05eede7660

View file

@ -306,7 +306,7 @@ module.exports = (
try { try {
if (!isAuthenticated()) { if (!isAuthenticated()) {
socket.emit('$shock', 'NOT_AUTH') socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
return return
} }
@ -370,7 +370,7 @@ module.exports = (
} }
}) })
io.of('/lndstreaming').on('connect', socket => { io.of('lndstreaming').on('connect', socket => {
// TODO: unsubscription // TODO: unsubscription
/** /**
@ -378,6 +378,11 @@ module.exports = (
*/ */
try { try {
if (!isAuthenticated()) {
socket.emit(Common.Constants.ErrorCode.NOT_AUTH)
return
}
const { services } = LightningServices const { services } = LightningServices
const { service, method, args: unParsed } = socket.handshake.query const { service, method, args: unParsed } = socket.handshake.query