Rooms
Rooms in Data Orchestrator Channels map 1:1 to Topics in Phoenix Channels, and can be joined in the very same way. Once a connection is established, the user can join any number of rooms, given he is authorized to do so.
A Room is identified by a topic with the following semantics: rooms:<realm>:<name>. For example,
rooms:test:myroom will join the Room myroom in the Realm test.
A room can be joined by any number of concurrent users. Rooms serve as containers for Transient
Triggers, which can be installed by any authorized user. Transient Triggers are actual
Triggers, with the difference that they exist within a Channels Room rather
than within a Realm - this mostly affects their timespan - and that the action can't be
configured - every time a Condition is triggered an event is delivered to users in the Room.
Events
Everytime a Condition of an installed Trigger is triggered, an event is sent to the Phoenix Channel, with a similar payload:
{
"device_id": "f0VMRgIBAQAAAAAAAAAAAA",
"event": {
"type": "device_connected",
"device_ip_address": "1.2.3.4"
}
}
device_id is always present (as long as the trigger matches a device) and identifies the device
emitting the event. event, instead, depends on the kind of installed trigger. It always carries a
type string, which identifies the content of the object. The complete list of possible
event payloads can be found here.
Lifecycle
Once a room is created, it remains valid and active with all of its subscriptions. There's little overhead in having a large number of rooms, as the only components leeching resources are Transient Triggers. As of today, Transient Triggers never expire - it is responsibility of the user to clean them up once the room becomes empty, if needed. In future versions, Transient Triggers will likely expire after some time, if left in an empty room.