rabbit.js icon indicating copy to clipboard operation
rabbit.js copied to clipboard

Disconnect a socket from a target

Open squaremo opened this issue 12 years ago • 4 comments

Worth having a way to unsubscribe a SUB (and the equivalent for other sockets?). Among other things this would delete the appropriate resources (ifUnused).

squaremo avatar May 15 '13 22:05 squaremo

I totally agree, now I have a project I need to cancel this sentence "this.client.connect" when the user leaves the channel and I cant do.

ping86 avatar May 27 '13 10:05 ping86

Thinking aloud: is Socket#destroy() appropriate for this?

squaremo avatar Jun 26 '13 15:06 squaremo

Among other things this would delete the appropriate resources (ifUnused).

Unfortunately this won't work, for a couple of reasons. Firstly, AMQP is stupid (who knew?): ifUnused will cause the channel to break should the queue or exchange be in fact used. Secondly, it wouldn't help anyway, because "used" means the wrong thing from our point of view. In the case of exchanges, it means bindings from the exchange, which won't always be in place (e.g., if there are no sub sockets at the time). In the case of queues, it means consumers, which again may not be in place.

Thinking aloud: is Socket#destroy() appropriate for this?

No, of course not, me. That's for invalidating the whole socket.

squaremo avatar Jul 05 '13 11:07 squaremo

Among other things this would delete the appropriate resources (ifUnused).

I can't think of a way to make sure exchanges are garbage collected.

squaremo avatar Mar 04 '14 13:03 squaremo