mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-18 05:42:03 +01:00
bouncer: close an already opened subscription
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
5d6e35ae7e
commit
a46b56adad
@ -91,10 +91,7 @@ module.exports = (ws, req, onClose) => {
|
||||
if (typeof(data[1]) !== "string") return ws.send(JSON.stringify(["NOTICE", "error: expected subID a string. but got the otherwise."]));
|
||||
if (typeof(data[2]) !== "object") return ws.send(JSON.stringify(["CLOSED", data[1], "error: expected filter to be obj, instead gives the otherwise."]));
|
||||
if ((max_client_subs !== -1) && (ws.subs.size > max_client_subs)) return ws.send(JSON.stringify(["CLOSED", data[1], "rate-limited: too many subscriptions."]));
|
||||
if (ws.subs.has(data[1])) {
|
||||
direct_bc(["CLOSE", data[1]], ws.id);
|
||||
cache_bc(["CLOSE", data[1]], ws.id);
|
||||
}
|
||||
if (ws.subs.has(data[1])) return ws.send(JSON.stringify(["CLOSED", data[1], "duplicate: subscription already opened"]));
|
||||
ws.subs.set(data[1], data.slice(2));
|
||||
ws.events.set(data[1], new Set());
|
||||
ws.pause_subs.delete(data[1]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user