The server is responsible for managing the API routes of the client and server application. It also runs the rtmp-server, the websocket chat server, as well as manages the osr_stream process.
- expressjs, used for basic api
- knex, used communicating with sqlite database
- socket.io, used to manage websocket chat system
- node-media-server, runs the rtmp-server for streaming media
- pm2, used to manage the osr_stream process which broadcasts to the rtmp server
- joi, basic validation package
/api/schedules/today
fetches daily schedules/api/history
returns the last 50 chat messages sent, called when the app starts up.
TODO
A basic usage case of the node-media-server
package. It can be configured by modifying the values in .env
.
It is responsible for the broadcasting stream, which gets published from the osr_stream. It exposes an endpoint that can be consumed by the client app via flv.js.
The websocket chat system is very basic. It responds to a small set of events:
message
, called when a user sends a message, stores it in sqlite and emits to all users.name-set
, called when a used attempts to set their username, will respond with eithername-accepted
orname-used
. will emituser-joined
to all users if name accepted.name-unset
, called when a user revokes thier username, emitsuser-left
to all users.disconnect
, called when socket connection closed, emitsuser-left
to all users.
TODO