<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="373960" data-post-id="373960">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="PaulOlukayode" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/PaulOlukayode/120/38640_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  PaulOlukayode
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>valid point. we did save in our architecture. very brilliant move. but you need to be careful on how to clean up.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Bimip.Device.Supervisor do
  #supervisor

use Horde.DynamicSupervisor
  require Logger

  @moduledoc """
  Dynamic supervisor for all device session children.
  """

  def start_link(_args) do
    Horde.DynamicSupervisor.start_link(__MODULE__, :ok, name: __MODULE__)
  end

  def init(:ok) do
    Horde.DynamicSupervisor.init(strategy: :one_for_one)
  end

  @spec start_session({ any(), any(), pid()}) :: {:ok, pid()} | {:error, any()}
  def start_session({eid, device_id, _ws_pid} = state) do
    child_spec = %{
      id: {:device_session, device_id},
      start: {Bimip.Device.Client, :start_link, [state]},
      restart: :transient,
      shutdown: 5000
    }

    case Horde.DynamicSupervisor.start_child(__MODULE__, child_spec) do
      {:ok, pid} -&gt;
        Logger.info("Bimip.Device.Client Session started for eid=#{eid}, device_id=#{device_id}, pid=#{inspect(pid)}")
        {:ok, pid}

      {:error, {:already_started, pid}} -&gt;
        Logger.warning("Bimip.Device.Client Session already exists for device_id=#{device_id}, pid=#{inspect(pid)}")
        {:ok, pid}

      {:error, reason} -&gt;
        Logger.error("Bimip.Device.Client Failed to start session for device_id=#{device_id}, reason=#{inspect(reason)}")
        {:error, reason}
    end
  end
end

</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Bimip.Supervisor.Orchestrator do
  #supervisor
  
  use Horde.DynamicSupervisor
  require Logger

  @moduledoc """
  Dynamic supervisor for all Mother processes (per user).
  """

  def start_link(_args) do
    Horde.DynamicSupervisor.start_link(__MODULE__, :ok, name: __MODULE__)
  end

  def init(:ok) do
    Horde.DynamicSupervisor.init(strategy: :one_for_one, members: :auto)
  end

  @spec start_mother(eid :: any()) :: {:ok, pid} | {:error, any()}
  def start_mother(eid) do
    case Horde.Registry.lookup(EidRegistry, eid) do
      [{pid, _value}] -&gt;
        Logger.info("Bimip.Service.Master already running for eid=#{eid}, pid=#{inspect(pid)}")
        {:ok, pid}

      [] -&gt;
        child_spec = %{
          id: {:orchestrator_session, eid},
          start: {Bimip.Service.Master, :start_link, [eid]},
          restart: :transient,
          shutdown: 5000
        }

        case Horde.DynamicSupervisor.start_child(__MODULE__, child_spec) do
          {:ok, pid} -&gt;
            Logger.info("Bimip.Service.Master started for eid=#{eid}, pid=#{inspect(pid)}")
            {:ok, pid}

          {:error, reason} -&gt;
            Logger.error("Failed to start Bimip.Service.Master for eid=#{eid}, reason=#{inspect(reason)}")
            {:error, reason}
        end
    end
  end
end

</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="373960" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-373960" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="373960"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="374084" data-post-id="374084">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kingdomcoder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kingdomcoder/120/24667_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kingdomcoder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi, <a class="mention" href="/u/bartblast" rel="nofollow">@bartblast</a></p>
<p>I think of PubSub in Hologram the same way I think of events—they’re triggers (that sometimes carry data). These server-side “events” can be similarly bound to actions/commands, and the rest of the Hologram plumbing immediately becomes available to us. I imagine new server-side functions <code>put_pubsub</code> and <code>delete_pubsub</code> as the main additions.</p>
<h3><a name="p-374084-add-a-subscription-1" class="anchor" href="#p-374084-add-a-subscription-1" aria-label="Heading link" rel="nofollow"></a>Add a Subscription</h3>
<p>To subscribe to a PubSub channel, call <code>put_pubsub</code> in <code>init/3</code> or <code>command/3</code>:</p>
<p><code>put_pubsub(server, pubsub_channel, command: :my_command)</code></p>
<p>or</p>
<p><code>put_pubsub(server, pubsub_channel, action: :my_action)</code></p>
<h3><a name="p-374084-delete-a-subscription-2" class="anchor" href="#p-374084-delete-a-subscription-2" aria-label="Heading link" rel="nofollow"></a>Delete a Subscription</h3>
<p>To unsubscribe from a PubSub channel, call <code>delete_pubsub</code> in  <code>command/3</code>:</p>
<p><code>delete_pubsub(server, pubsub_channel)</code></p>
<p>or</p>
<p><code>delete_pubsub(server, pubsub_channel)</code></p>
<p>I suggest there should also be a cleanup mechanism that unsubscribes when a component is removed from the page.</p>
<h3><a name="p-374084-to-handle-a-message-3" class="anchor" href="#p-374084-to-handle-a-message-3" aria-label="Heading link" rel="nofollow"></a>To Handle a Message</h3>
<p>Each time a pubsub message is received, its corresponding command/action is triggered and can be handled as such:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def command(:my_command, pubsub_msg, server) do
  # do something with the message
end
</code></pre>
<pre data-code-wrap="elixir"><code class="lang-elixir">def action(:my_action, pubsub_msg, component) do
  # do something with the message
end
</code></pre>
<p>Additionally, I don’t think PubSub handling should be restricted to pages. This is one of the banes I have with LiveView where <code>handle_info</code> is available only in the LiveView and not in LiveComponents. Each component should be able to call <code>put_pubsub</code> and <code>delete_pubsub</code> in its own <code>init/3</code> and <code>command/3</code> functions.</p>
<p>Finally, I wouldn’t recommend adding a <code>target</code> option to <code>put_pubsub</code> where a subscription in one page/component can trigger a command or action in another. Each page/component should subscribe independently to a channel if it needs to react to messages. This is not a “hard” suggestion, but I think it will help avoid confusion.</p>
<p>PS: Thank you for always welcoming input from the community. We’re grateful for your hard work <img src="https://forum.elixirforum.com/images/emoji/apple/clap.png?v=15" title=":clap:" class="emoji" alt=":clap:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/clap.png?v=15" title=":clap:" class="emoji" alt=":clap:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374084" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-374084" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374084"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="374131" data-post-id="374131">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bartblast" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/120/17647_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bartblast
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Hologram</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="jam" data-post="14" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jam/48/36266_2.png" class="avatar"> jam:</div>
<blockquote>
<p>Maybe subscribe should include some way to authorize. I’m not sure if you’re thinking authorization would be elsewhere.</p>
</blockquote>
</aside>
<p>Yep, I’m also interested in the authorization part - the whole flow. How could this look in your opinion?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374131" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-374131" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374131"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="374133" data-post-id="374133">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bartblast" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/120/17647_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bartblast
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Hologram</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/garrison" rel="nofollow">@garrison</a> Thanks for sharing your perspective! I’m definitely considering different approaches here.</p>
<p>Your vision is compelling, though I notice it does require a central data store as the coordination point. Before I dive deeper into that direction, I’m curious about a few practical aspects:</p>
<p>Do you see any specific applications where classic imperative pub/sub might still make sense? I’m thinking particularly about high-frequency or ephemeral events - like cursor tracking in a collaborative drawing app, typing indicators, or even simple toast notifications.</p>
<p>Would you advocate for a hybrid approach there, or do you think everything should flow through the database layer? If hybrid, where would you draw those boundaries?</p>
<p>And practically speaking - if we’re tracking cursor positions today and want to add pressure sensitivity tomorrow, wouldn’t we need database migrations for what’s essentially transient data? That feels like it could add overhead for things that are naturally ephemeral.</p>
<p>I’m genuinely curious how you’d handle these cases in your architecture. The consistency guarantees are appealing, but I want to make sure we’re not over-engineering the simple stuff.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374133" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-374133" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374133"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="374137" data-post-id="374137">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="bartblast" data-post="25" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/48/17647_2.png" class="avatar"> bartblast:</div>
<blockquote>
<p>I’m definitely considering different approaches here.</p>
</blockquote>
</aside>
<p>I would say that <strong>at least for now</strong> you should go the “safe way” and implement <code>Pub/Sub</code> that is very similar to the <code>phoenix</code> one. Of course some framework-related things have to be adjusted (actions vs <code>handle_*</code> functions), but I would rather stay with <strong>similar</strong> naming concept simply to make migrating existing applications to <code>Hologram</code> as simple as possible.</p>
<p>I think that’s fastest way, best for initial adoption and does not block possible alternative solutions in future. Maybe a good point would be to release it as <code>hologram_pubsub</code>, so it’s not considered as a part of the <code>core</code> and could be easily replaced only by updating generators (if any) and guides.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374137" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-374137" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374137"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #25"></div>
  </section>
</div>
    <div class="postbit" id="374141" data-post-id="374141">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>First of all I want to be very clear that your vision is <em>much</em> more important than mine. Hologram is your project and you have a better idea of where you want it to go than I do. And at the end of the day I am a programmer too; if I want a framework built a certain way, I can do it myself. No excuses there.</p>
<p>I only want you to consider my feedback if it’s something you <em>haven’t thought of</em>. If you disagree with me then don’t worry about it!</p>
<aside class="quote no-group" data-username="bartblast" data-post="25" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/48/17647_2.png" class="avatar"> bartblast:</div>
<blockquote>
<p>I’m thinking particularly about high-frequency or ephemeral events - like cursor tracking in a collaborative drawing app, typing indicators, or even simple toast notifications.</p>
</blockquote>
</aside>
<p>So first of all, yes there are <em>some</em> things which really are ephemeral. And no, I don’t think I would run cursor positions through the database.</p>
<p>But I don’t think I would run them through PubSub either. For one, architecturally this means sending all messages to all nodes in order to get them to the right user, when really you would want to send all users to one node. Unless you really have <em>massive</em> fanout.</p>
<p>But also, topic-based PubSub is a very blunt tool. Apps with rich functionality have complex requirements which are difficult to express this way. I mean, what if I want to send a subset of cursors to a subset of users? If you have a passing familiarity with WebRTC you know this is <a href="https://hexdocs.pm/ex_webrtc/0.15.0/simulcast.html#switching-between-simulcast-encodings" rel="noopener nofollow ugc">far from a hypothetical</a>, even in relatively simple cases.</p>
<p>What I would probably do is embrace OTP and create a “room” abstraction (a server process) which sends/receives messages to clients. Note that this is not PubSub because <em>there is no fanout</em>. I would then store the location of said process (the node in a distributed setting) in the database as well as whatever else is needed to look it up (maybe the name of the room).</p>
<p>Then I could implement the room as a GenServer or whatever that sends and receives the ephemeral data. In the limit you could imagine this functioning like a game server. Actually, it may be helpful to reason about what would happen if you tried to build a game server using PubSub.</p>
<aside class="quote no-group" data-username="bartblast" data-post="25" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/48/17647_2.png" class="avatar"> bartblast:</div>
<blockquote>
<p>And practically speaking - if we’re tracking cursor positions today and want to add pressure sensitivity tomorrow, wouldn’t we need database migrations for what’s essentially transient data?</p>
</blockquote>
</aside>
<p>I think this is orthogonal. You could just as easily store unstructured data in a database. Alternatively you could design a schema migration system that is actually good (I’m doing this too).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374141" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-374141" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374141"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="374142" data-post-id="374142">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="26" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>I would say that <strong>at least for now</strong> you should go the “safe way” and implement <code>Pub/Sub</code> that is very similar to the <code>phoenix</code> one.</p>
</blockquote>
</aside>
<p>But what I was getting at earlier is: do you even need to do this at all? I mean, Phoenix PubSub doesn’t actually depend on Phoenix, does it? It’s not clear to me why we can’t just have one PubSub package for Elixir and be done with it.</p>
<aside class="quote no-group" data-username="kingdomcoder" data-post="23" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kingdomcoder/48/24667_2.png" class="avatar"> kingdomcoder:</div>
<blockquote>
<p>Additionally, I don’t think PubSub handling should be restricted to pages. This is one of the banes I have with LiveView where <code>handle_info</code> is available only in the LiveView and not in LiveComponents.</p>
</blockquote>
</aside>
<p>This is actually a reasonable counter to the above argument, though we could still build on one PubSub package.</p>
<p>I’ve done this manually before (a static router that sends PubSub messages to the correct LiveComponents) and in practice you only want to send some messages to some components which opens up that can of worms all over again. I suppose you could just match on a subset of messages in each component and throw the rest away, though this is suboptimal for performance (but probably won’t matter).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374142" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-374142" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374142"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #27"></div>
  </section>
</div>
    <div class="postbit" id="374153" data-post-id="374153">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="28" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>But what I was getting at earlier is: do you even need to do this at all? I mean, Phoenix PubSub doesn’t actually depend on Phoenix, does it? It’s not clear to me why we can’t just have one PubSub package for Elixir and be done with it.</p>
</blockquote>
</aside>
<p><code>Hologram</code> (at least for now) does not support process messaging (<code>handle_*</code> functions) and if it does then people may overuse it instead of working with <code>commands</code> and maybe even <code>actions</code>. I guess that at best <code>Hologram</code> would support <code>handle_*</code> functions only internally (not within components and pages) and so we need extra code to make it work with <code>commands</code> and <code>actions</code>.</p>
<p>Obviously there is no package that “just works” in background right after you add it in deps. You need some code even for simplest API calls and because of it we have to add a support this or other way. What you expect happens maybe in OOP frameworks where specific file structure and code is required to make project work. In <code>Elixir</code> we can do a lot with metaprogramming, but not much magic tricks unless we would really work on some strict framework where features like that are hidden. However this usually means a terrible long stacktrace and is rather seen as a bad practice in <code>Elixir</code>.</p>
<p>So anyway we have to add some code. I only suggested that no matter if support for existing package will take 10 LOC or 10_000 LOC we could put them in the separate package following <code>phoenix_pubsub</code> naming. Also please keep in mind that this naming is used for some reason as otherwise it would be called just <code>pubsub</code>. Since <code>Hologram</code> is intended to work independently from <code>phoenix</code> (at least from developer perspective) it may not guarantee a compatibility with every <code>phoenix_*</code> package especially if it expects some <code>phoenix</code>-related context. The simplest examples are always best, so think that every component package for <code>LiveView</code> would not work in <code>Hologram</code> simply because of different templates used in those packages.</p>
<p>We know that <code>phoenix_pubsub</code> requires process messaging and especially if we would have multiple processes (for communicating via commands on server and actions on client) <code>phoenix_pubsub</code> may or may not be enough for <code>hologram</code> and either we would have a wrapper for each process or we would have to rewrite this functionality. I’m not saying what’s best as I did not took into <code>Hologram</code> sources deep enough.</p>
<p>So it’s up to <a class="mention" href="/u/bartblast" rel="nofollow">@bartblast</a>. I can only guarantee that people would have tons of scenarios for both <code>server</code> and <code>client</code> side pubsub-like system. However everything depends on how the process communication would look like in <code>Hologram</code>. Until decided it’s one big unknown. There is as same chance that we could use or share a big part of <code>phoenix_pubsub</code> or we can go completely different way. When I respond I don’t have expectations how things would look inside, but what stuff I would be able to do with public API and I guess this thread was created for exactly such reason.</p>
<p>Oh btw. I wonder if <code>CQRS/Event sourcing</code> with <code>commanded</code> package could have few things to say in this topic too. <img src="https://forum.elixirforum.com/images/emoji/apple/thinking.png?v=15" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374153" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-374153" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374153"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #28"></div>
  </section>
</div>
    <div class="postbit" id="374225" data-post-id="374225">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jam" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jam/120/36266_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jam
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think it depends on what you have in mind based on the <a href="https://forum.elixirforum.com/t/how-to-approach-authentication-and-authorization-in-hologram/72527" rel="nofollow">authorization thread</a>. <img src="https://forum.elixirforum.com/images/emoji/apple/slightly_smiling_face.png?v=15" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:" loading="lazy" width="20" height="20"></p>
<p>Maybe it’s best to authorize in the <code>init</code> and leave <code>subscribe</code> purely as the way to listen to a topic. That way there’s only one place to house authorization logic and it works the same regardless of whether the app uses pubsub.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374225" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-374225" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374225"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #29"></div>
  </section>
</div>
    <div class="postbit" id="374283" data-post-id="374283">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="bartblast" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartblast/120/17647_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  bartblast
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Hologram</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="PaulOlukayode" data-post="21" data-topic="72519">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/paulolukayode/48/38640_2.png" class="avatar"> PaulOlukayode:</div>
<blockquote>
<p>Well, Pub/Sub is interesting. Check out <strong>my Stanza for the messaging protocol</strong> I am working on—you can refer to my documentation. (…)</p>
</blockquote>
</aside>
<p>Hi <a class="mention" href="/u/paulolukayode" rel="nofollow">@PaulOlukayode</a>, thanks for sharing your project. Could you help me understand how your project specifically relates to the Pub/Sub design questions I raised for Hologram?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="374283" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/time-to-implement-pub-sub-in-hologram-looking-for-your-input/72519/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-374283" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="374283"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #30"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/72519/load_more?page=4">Load more posts (18 remaining)</a>
</div></template></turbo-stream>