Skip to main content
Version: 8.1.0

🔌 WebSocket

The app keeps a Socket.IO connection open to https://controller.ecoledirecte.com (default path /socket.io). In this version it is used for one thing: new messages in the discussion of a workspace.

Authentication​

Every payload carries token: the socketToken of the account, returned by the login. There is no other handshake.

Connect​

  1. Open the connection.
  2. One second after the connect event, emit join-{typeCompte} (e.g. join-E, join-P) with:
{ "token": "socketToken" }
  1. Listen to the event message.

To disconnect, emit leave-{typeCompte} with the same payload, then close the connection.

Events​

EventDirectionUse
join-{typeCompte}emitStart receiving
leave-{typeCompte}emitStop receiving
notification-messageemitA new workspace message, for the other members
messagereceiveWhat another client emitted with notification-message

Message​

Sent with notification-message, received with message:

{
"data": { // The workspace message, same fields as the HTTP one
"id": 1234,
"dateCreation": "2025-10-03 10:00:00",
"isModere": false,
"contenu": "", // Base64 HTML
"auteur": {
"idAuteur": 1234,
"profil": "E", // Account type of the author
"nom": "DUPONT",
"prenom": "Jean",
"photo": "",
"libelleClasse": "",
"fonctionPersonnel": ""
},
"idTopic": 1234
},
"author": { // Who emits
"profil": "E",
"idUser": 1234,
"ogec": "0000000A"
},
"notification": { // What the receiver shows
"action": "/{profile}/{idUser}/EspacesTravail/1234?item=discussion&topic=1234", // App route to open
"body": "…", // HTML text
"icon": "fa workplace",
"title": "Nouvelle discussion",
"type": "info"
},
"token": "socketToken",
"target": { // Optional: which workspaces
"espacesW": [{ "id": 1234 }]
},
"targetUsers": [] // Optional: individual recipients (same shape as author)
}

What the app does​

On message, the app ignores the message when target.espacesW is empty or when it comes from the same account (author.profil, author.idUser and author.ogec all equal to its own). Otherwise it adds data to the topic data.idTopic of its workspaces.

The emitter first posts the message over HTTP (Post a message) and only then emits the socket event.