Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/phoenix/pubsub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,17 @@ defmodule Phoenix.PubSub do
Registry.unregister(pubsub, topic)
end

@doc """
Unsubscribes the caller from the PubSub adapter's topic taking the metadata into consideration
Unlike `unsubscribe/2` this function match on the metadata provided as option when subscribed

This is usually needed if you have multiple subscriptions for the same topic with different metadata
"""
@spec unsubscribe(t, topic, metadata) :: :ok
def unsubscribe(pubsub, topic, metadata) when is_atom(pubsub) and is_binary(topic) do
Registry.unregister_match(pubsub, topic, metadata)
end

@doc """
Broadcasts message on given topic across the whole cluster.

Expand Down