2

I'm making a Phoenix application that listens to events from some general broadcaster and it sends them to all connected WebSocket client's through Channels.

Whenever WebSocket connects it subscribes to the Broadcaster

Kernel.send(:subscribe, self())

But when the socket gets closed it's not being removed from subscribers list.
Is there a way to detect disconnection of a channel member? Or can I detect if the socket I'm pushing to is already closed?

Cheers

1
  • 1
    Check Process.monitor/1 and how process monitoring works. Also, you want to look at GenServer and the like. We rarely use things like send/2. Aug 21, 2015 at 20:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.