StreamId
Represents a unique ID for a stream.
This is commonly used when indicating which other streams should receive (or NOT receive) a broadcast message:
// Exclude from self:
ctx.stream.broadcastExcluding("Hello, everyone else!", ctx.stream.id)
As this class is simple, immutable data, it is totally safe to store a copy of it after receiving some event, e.g. if you receive a ClientConnected
event, without worrying about major memory leaks. Just be sure to remove it when you receive a ClientDisconnected
event that contains that stream ID.
In most cases, a user will only ever create a single client stream per API stream endpoint they want to connect to. However, a user could technically create multiple streams that attach to the same endpoint, and each one will get its own unique stream ID.
NOTE: A stream's ID is a hashed combination of its clientId and its localStreamId, which are both exposed as well.