From 5ff65b1c5c91de9773ec03b57874effa61c8bb08 Mon Sep 17 00:00:00 2001 From: Mattias Erming Date: Sat, 26 Apr 2014 23:17:20 +0200 Subject: [PATCH] Update README.md --- README.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/README.md b/README.md index 2d2ad54..75de002 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,60 @@ These are the commands currently implemented: 6. Open your browser `http://localhost:9000` + +## Events +Using [Socket.IO](http://socket.io/) +Events sent from the __server__ to the __browser__: +```javascript +// Event: "join" +// Sent when joining a new channel/query. +socket.emit("join", { + id: 0, + chan: { + id: 0, + name: "", + type: "", + messages: [], + users: [], + } +}); + +// Event: "msg" +// Sent when receiving a message. +socket.emit("msg", { + id: 0, + msg: { + time: "", + type: "", + from: "", + text: "", + } +}); + +// Event: "networks" +// Sent upon connecting to the server. +socket.emit("networks", { + networks: [{ + id: 0, + host: "", + nick: "", + channels: [], + }] +}); + +// Event: "part" +// Sent when leaving a channel/query. +socket.emit("part", { + id: 0 +}); + +// Event: "users" +// Sent whenever the list of users changes. +socket.emit("users", { + id: 0, + users: [{ + mode: "", + name: "", + }] +}); +```