Skip to main content

Bounded Contexts

The bounded contexts of the system are:

  • Auth
  • Profile
  • Session

In the following sections, each one will be described in detail. Commands, Events, and Reactions are grouped based on the aggregate they're related to.

Auth

The authentication context is responsible for managing user authentication to the Let's Stream It platform. It manages user registration and login.

Ubiquitous Language

TermMeaning
UserAnyone registered to the system
TokenA unique identifier for a User
Access TokenA token used to authenticate the User
Refresh TokenA token used to refresh the Access Token

Profile

Profile context is responsible for managing the user profile information in the Let's Stream It platform. It manages the user's username, bio, and watched videos.

Ubiquitous Language

TermMeaning
UserAnyone registered to the system
ProfileUser's profile information
VideoA Youtube video

Session

Session Service is the core of Let's Stream It and is responsible for managing a Youtube streaming session.

It ensures synchronized video playback, in response to play and stop performed by the users. It also manages a chat through which users can communicate with each other while watching the video.

Ubiquitous Language

TermMeaning
UserAnyone registered to the system
VideoA Video is a YouTube video
Video StatePair of values representing the current timestamp of the video and if it's Playing/Stopped
Text messageTexual message sent by a User
Notification messageMessage sent by the context
ChatA Collection of Text Messages
SessionA group of Users watching a Video and interacting with a Chat

Commands

Session

Commands related to Session aggregate concern Session creation and joining:

  • UserTokenCommand: sent whenever an actor wants to connect to the context;
  • CreateSessionCommand: sent whenever a User wants to create a new session;
  • JoinSessionCommand: sent whenever a User wants to join an existing session;
  • LeaveSessionCommand: sent whenever a User wants to leave a session.

Chat

  • SendMessageCommand: sent whenever a User wants to send a message in the Chat.

Video

  • PlayVideoCommand: sent whenever a User wants to play the Video;
  • StopVideoCommand: sent whenever a User wants to stop the Video.

Events

Events are emitted when commands are accepted and validated by the context.

Session

  • SessionCreatedEvent: triggered whenever a new Session is created;
  • UserJoinedSessionEvent: triggered whenever a User joined a Session;
  • UserLeftSessionEvent: triggered whenever a User leaves a Session.

Chat

  • MessageSentEvent: triggered whenever a User has sent a message in the Chat.

Video

  • VideoPlayedEvent: triggered whenever a User has played the Video;
  • VideoStoppedEvent: triggered whenever a User has stopped the Video;

Reactions

Reactions are actions that are executed whenever an event occurs. In the Session context, they correspond to actions performed to communicate back with Users, either single Users or all Users connected to a Session.

Session

  • joinUserToSession: executed whenever the aggregate wants to add the User reference to the list of connected Users;
  • leaveUserFromSessionAndDisconnect: executed whenever the aggregate wants to remove the User reference from the list of connected Users.

Chat

  • emitNotificationToSession: executed whenever the aggregate wants to emit a Notification Message to the Session;
  • emitTextMessagesToClient: executed whenever the aggregate wants to emit one or more Text Messages to a single User;
  • emitTextMessagesToSession: executed whenever the aggregate wants to emit one or more Text Messages to all the Users connected to the Session.

Video

  • retreiveVideoState: executed whenever the aggregate wants to retrieve the Video state from a single User;
  • synchronizeClient: executed whenever the aggregate wants to synchronize the Video of a single User;
  • syncronizeSession: executed whenever the aggregate wants to synchronize the Video of all Users connected to the Session.