Rooms are views of messages together with a form that allows users to add a new message. When a new message is added, it will be sent to all other views connected to the same view in real time.
Real-time chat rooms can be used for two different scenarios:
Other use cases for chat rooms are not possible right now but will be developed later.
Creating a room requires three tables:
These tables do not have to be created exclusively for the purposes stated above, for instance if you are creating a book discussion group then the table for books could serve as the room table.
You also need to create two views of the messages table
Once these tables and views are in place, you can create a view of the Room view template. You have to specify the relation to the participant and message tables, and of views for showing messages and the form for creating a new message.
Once you have created the room view, you need to link to it in the context of a specific row in the room table. Linking merely to the room view will not work as you need to view a particular room, not all rooms in general. In this sense the room views works like the show views. For instance, you could create a list of the rooms using the List view template, and add a column which is a link to another view, choosing the room view. Alternatively, if you only have one room and you know the ID for the corresponding row in the room table, you can create a link such as /view/MyRoom?id=1. Here, 1 is the row id in the room table.