/hackathon-editor-collab-server

Repo for the websocket server for hackathon

Primary LanguageJavaScript

hackathon-editor-collab-server

Repo for the websocket server for hackathon

Message API

(protocol version 4)

Glossary

  • Participant — anyone connected to the session
  • Presenter — a participant currently editing the site 🐵
  • Spectator — a participant following the presenter's activity 🐠

Server → Client

session 🐵 🐠

Object { id, participants: { id:name }, presenterId, snapshot? } 
// session spectator data and (optionally) state snapshot

spectator-joined 🐵 🐠

Object { spectatorId, name } // 'spectatorId' has joined the session

spectator-left 🐵 🐠

Object { spectatorId } // 'spectatorId' has left the session

presenter-changed 🐵 🐠

Object { presenterId } //  'presenterId' has become the presenter

control-requested 🐵

Object { spectatorId } //  spectator 'spectatorId' requested control

control-denied 🐠

//  participant's control request was denied

request-snapshot 🐵

// newly connected spectator requests state snapshot

change 🐠

Object change // got a change from the presenter

chat 🐵 🐠

Object { participantId, message } // got a chat message

Client → Server

join 🐵 🐠

Object { name, siteId } // user 'name' joins session 'siteId'

snapshot 🐵

Object { snapshot } // presenter sends snapshot

change 🐵

Object change // send a change to spectators

chat 🐵 🐠

Object message // send a chat message to everyone in the session

request-control 🐠

// request presenter control

take-control 🐠

// unconditionally take presenter control

grant-control 🐵

Object { spectatorId } // grant presenter control to 'spectatorId'

deny-control 🐵

Object { spectatorId } // deny presenter control to 'spectatorId'