Module: DurableStreams::Rails::StreamProvisioner
- Included in:
- DurableStreams
- Defined in:
- lib/durable_streams/rails/stream_provisioner.rb
Overview
Ensures streams exist on the Durable Streams server before they are used.
The Durable Streams protocol requires explicit stream creation (PUT) before any read (GET/SSE) or write (POST) operation — unlike Action Cable which auto-creates channels on subscribe. This module hides that requirement from application code.
Both the signing path (signed_stream_url) and the broadcast path (append_to_stream) call ensure_stream_exists. A thread-safe Concurrent::Set cache ensures the PUT only fires once per stream name per process, regardless of which path touches the stream first.