Scenic.Assets.Stream.subscribe

You're seeing just the function subscribe, go back to Scenic.Assets.Stream module for more information.

Specs

subscribe(id :: String.t()) :: :ok

Subscribe to changes in a named stream.

Call this from a GenServer, typically a Driver or something you manage yourself.

When an asset stream is updated you will receive the following message.

{{Stream, :put}, stream_type, id}

You can match against stream_type to select certain kids of assets. Use the id to fetch the contents of the asset.

When an asset stream is deleted, you will receive the following message. {{Stream, :delete}, stream_type, id}

You can subscribe to an stream before it has been published. You will then start receiving put messages when it is created. Your subscription will not end if the stream is deleted.