Skip to main content

Models & Sockets

This section contains detailed information about the main models, events, and properties or variables used in adapt-media-presence. These components make up a large portion of the API or events that help run SME Connect.

Models

The main classes in adapt-media-presence are models used to distinguish rooms, users, invites, userRooms, otps, and emails. The majority of these models are subclasses of the main model class and share properties and methods. Examples of shared methods include finding a DB entry, updating a record in the DB, and deleting a record.

Each subclass of model may have unique properties and methods used to regulate the database information.

There are also classes involved with SocketIO events. These classes handle processing the socket information and events that alert users to changes and connections in a room.

Main Model & Extended Classes

The main model class contains numerous shared methods and properties that are shared between varied classes. The class diagram below highlights the shared and individual properties and methods for these classes.

Socket IO Shared Models

A SocketEventHandler class provides shared methods for different socket events.

Non-shared classes

The SocketRoomHandler and Email classes are two remaining major classes in presence that do not have shared properties/methods with other classes.

Socket Events / Functions

SocketIO events such as broadcast, data, and join are also detailed in this documentation. These events are triggered based on a user's interactions, such as joining a room or leaving a room. These events allow for a smoother and faster set of connections and interactions with users, such as alerting when someone is joining a room. These events also negate the previous need for continuous polling, as the events will alert someone to changes or connections needed in a room.

Information on Socket.IO

Modules

ModuleDescription
CosmosThe Cosmos Object contains the unique properties and methods used to make database queries and requests to cosmos.
EmailThe Email model includes unique properties and methods for the email process.
ModelThe Model class is a generic base model for common properties and methods to be shared between other models.
OTPThe OTP model includes unique properties and methods for the OTP data.
PermissionsSpecific actions, such as creating a room or kicking a user, are limited to certain users based on their email (UID) and their login method. The isUserAuthorized function checks if a user is authorized to perform such actions.
RoomThe Room model includes unique properties and methods for the Room data.
RoomInviteThe RoomInvite model includes unique properties and methods for the RoomInvite data.
SocketSocket contains the classes and functions that relate to Socket Events and Data
Socket EventsThese events are either Socket.IO specific functions or functions triggered based on user actions, such as making room connections or requesting to join a room.
UserThe User model includes unique properties and methods for the User data.
UserRoomThe UserRoom model includes unique properties and methods for the UseRoom data. This class is for the specific rooms a user has been approved for.