1 Event Manager
Dan Ballard edited this page 2019-09-24 13:55:04 -07:00

The Cwtch Event Manager is an event bus within the Cwtch Client that allows subssystems (the UI, Storage Engine and Protocol Engine(s) to send and receive events from eachother).

Requirements

Subsystems should be able to subscribe to a given set of events, and then receive all events in that category. Events are received by each subsystem via a channel.

The EventManager has the following API:

  • Subscribe(Event, Channel)
  • Publish(Event)

Each Subsystem will have a pointer to the event manager Publish function.

Protocol Engine Events

Sends:

  • GROUP INVITE RECIEVED
  • GROUP MESSAGE RECIEVED
  • CONTACT REQUEST RECIEVED
  • CONTACT MESSAGE RECEVIED
  • CONTACT MESSAGE ACKNOWLEDGED

Listens For:

  • SEND CONTACT MESSAGE
  • SEND GROUP MESSAGE
  • GROUP INVITE ACCEPTED

UI

Sends:

  • SEND CONTACT MESSAGE
  • ADD CONTACT
  • EDIT CONTACT
  • DELETE CONTACT
  • BLOCK CONTACT
  • NEW PROFILE

Listens For:

  • GROUP INVITE RECIEVED
  • GROUP INVITE ACCEPTED
  • GROUP MESSAGE RECIEVED
  • CONTACT REQUEST RECIEVED
  • CONTACT MESSAGE RECEVIED
  • CONTACT MESSAGE ACKNOWLEDGED

Storage Engine

Listens For:

  • GROUP INVITE RECIEVED
  • GROUP INVITE ACCEPTED
  • GROUP MESSAGE RECIEVED
  • ADD CONTACT
  • EDIT CONTACT
  • DELETE CONTACT
  • SEND CONTACT MESSAGE
  • SEND GROUP MESSAGE
  • CONTACT REQUEST RECIEVED
  • CONTACT MESSAGE RECEVIED
  • CONTACT MESSAGE ACKNOWLEDGED
  • PROFILE EDITED

Sends:

  • STORAGE ERROR