Skip to content

Add init_channels/0 function

Compare
Choose a tag to compare
@stepnivlk stepnivlk released this 16 Apr 22:38
· 10 commits to master since this release
7e0e662

init_channels/0 allows to subscribe to given list of channels during the startup of your app.

Example:

defmodule SimpleClient do
  use Pushest, otp_app: :simple_client

  def init_channels do
    [
      [name: "public-init-channel", user_data: %{}],
      [name: "private-init-channel", user_data: %{}],
      [name: "presence-init-channel", user_data: %{user_id: 123}],
    ]
  end
end

Each element of the list has to be a keyword list with name and user_data keys with values of following type: [name: String.t(), user_data: map]