Accessing stream from socket in handle_param

in my handle_param I used IO.inspect(socket) and my assigns is below

How am I able to access streams.checkin? It doesn’t seem to have the data rows from the table.

This is the line of code used to stream the data to the client:

   {:ok, stream(socket, :checkins, Customer.list_active_checkins())}

partial output from IO.inspect(socket):

assigns: %{
    __changed__: %{},
    checkin: nil,
    current_user: %EvikeEventPhx.Outpost.User{
      __meta__: #Ecto.Schema.Metadata<:loaded, "outpost_users">,
      outpost_users_id: 1,
      outpost_users_username: "jshen",
      outpost_users_pw: "1111",
      outpost_id: 5,
      outpost_users_firstname: "Jason",
      outpost_users_lastname: "Shen",
      outpost_users_pin: "1111",
      customers_id: 1584159,
      status: 1,
      access_admin: 1,
      access_pos: 1
    },
    event_name: "Evike Outpost Houston/High Ground Airsoft Airsoft Palooza 2023",
    flash: %{},
    live_action: :index,
    page_title: "Listing Checkins",
    streams: %{
      __changed__: MapSet.new([]),
      checkins: %Phoenix.LiveView.LiveStream{
        name: :checkins,
        dom_id: #Function<3.113057034/1 in Phoenix.LiveView.LiveStream.new/3>,
        inserts: [],
        deletes: []
      }
    }

Thank you.

One of the main goal of streams is to free up resources on the server by not storing the resources in the socket and keeping only references to the streamed resources via DOM ids.

Depending on what you’re trying to do, you might want to assign rather than stream those checkins if you need or want them to be available on the server in subsequent socket lifecycle callbacks.

1 Like