-
Notifications
You must be signed in to change notification settings - Fork 3
Architecture
The ASQ app utilizes websockets to transfer events between connected clients and the server. The basic entitities of the app are:
In the following sections we present the architecture of the basic entities of ASQ
* *name* : `String` Name of the user (must be unique). * *password* : `String` (Password, stored as plain text...) * *email* : `String` Email of the user. * *slides* : `[ObjectId]` References to all the slides in the db owned by the user. * *current* : `ObjectId` Reference to the current session hosted to the user. (Defaults to `null`). * *title* : `String` Title of the slideshow * *course* : `String` Used for categorization (Max please confirm!) (Defaults to `General`) * *owner* : `ObjectId` Reference to the owner of the slideshow. * *questions* : `[ObjectId]` References to the questions related to the slideshow. * *links* : `[String]` : Links to be included with the slideshow in the head part of the page. (For css and such.) * *path* : `(Virtual) String` : Local path to the slideshow folder on the server, to be used internally only. * *questionText* : `String` Text of the question * *questionType* : `String` Used to categorize the question by its type * *afterslide* : `String` Indicates after which slides the question comes * *answeroptions* : `[ObjectId]` References to the possible answer options provided with the question. * *optionText* : `String` Text of the option * *correct* : `String` "yes" or "no" to indicate the correctness of the option * *presenter* : `ObjectId` Reference to the user in control of the session. * *slides* : `ObjectId` Reference to the slides used in the session. * *activeSlide* : `String` Id of the current slide (ids are generated by impress.js), defaults to `'0'`. * *date* : `Date` Date of the session. Default to the date of creation. * *viewers* :`[String]` Keep track of the nicknames of viewers as string * *answers* :`[ObjectId]` Store the id of the answers submitted by viewers. (Ansers are stored in a different db.) * *showingQuestion* : `Boolean` Indicates the state of a question popup. * *showingAnswer* : `Boolean` Indicates the state of a answer popup. * *question* : `Method with callback` Callback return err and question. If there no error, err is null. If there is no question, question is null. * *path* : `String` (Virtual) Returns the path to the folder containing the slides.Websockets connect immediately once the page is loaded. Admin sockets should be authenticated. Unless specified otherwise, events are only transmitted to sockets within the same session (in all namespaces).
Events transmitted to and from the server via websockets should have the following structure:
asq:<event name>
where<event name>
is meaningful and unique name to describe the event.
Local events should start with the
local
prefix. See below.
-
asq:viewer
: Emitted by a viewer when he first joins thefolo
namespace. -
asq:viewers-update
: Emitted to thectrl
namespace to notify of a change in thefolo
namespace. -
asq:admin
: Emitted by an admin when he first joins thectrl
namespace. -
asq:start
: Emitted when the presentation starts. Sent to all namespaces. Also sent to new sockets which connects after the presentation has started. -
asq:goto
: Emitted by an admin when he moves to a slide. Re-transmitted to all namespaces.
If there is a question, aquestion
event is transmitted instead. -
asq:goto-force
: Similar toasq:goto
but forces to move to a slide. (Obsolete) -
asq:question
: Emitted from thectrl
namespace when a question needs to be displayed. -
asq:answer
: Emitted fromctrl
to all namespaces. Indicates a popup answer must be displayed. -
asq:hide-answer
: Emitted fromctrl
to all namespaces. Indicates a popup answer must be hidden. -
asq:submit
: Emitted by followers (in thefolo
namespace) when a follower submits his answer to a question. -
asq:resubmit
: Similar to submit but called instead of submit every time after submit has been emitted initially.
This is also a form of client-side filtering which should not be present and needs to be changed.
asq:show-stats
Client side events are event triggered locally on the client (mostly to cinteract with the web-socket) and are not sent to the server.
-
local:submit
: Triggered from a viewer, when he wants to submit an answer for the first time. -
local:resubmit
: Triggered from a viewer when he wants to change (resubmit) his answer for a different one. (This should be changed to a single submit event and the server should find out if it is a resubmit or not.)
-
/live/:user/
:Verb: GET
Follow a live presentation from user :user. -
/admin/
:Verb: GET
Control your live presentation. -
/user/:user/upload/
:Verb: POST
Upload a presentation archive. (The archive must be located atreq.files.upload
) -
/start/:id/
: Initialize a new session with the slides matching id, providing the authenticated use matches the owner of the slides.
Use absolute path to serve files from the public folder. For example to serve the file style.css in the css folder in public,
the path should be/css/style.css
and notcss/style.css
.
All paths should end up with a trailing
/
.
More details on routes can be found on the routes page.
The following routes are reserved and used for the websocket traffic.
-
/ctrl
: Used to control the presentation, (ie. To emitgoto
events and such.) require authentification -
/folo
: Used to follow a presentation, receivegoto
events and submit answers to questions and such.