🔌 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
- Open the connection.
- One second after the
connectevent, emitjoin-{typeCompte}(e.g.join-E,join-P) with:
{ "token": "socketToken" }
- Listen to the event
message.
To disconnect, emit leave-{typeCompte} with the same payload, then close the connection.
Events
| Event | Direction | Use |
|---|---|---|
join-{typeCompte} | emit | Start receiving |
leave-{typeCompte} | emit | Stop receiving |
notification-message | emit | A new workspace message, for the other members |
message | receive | What 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.