| @@ -262,6 +262,14 @@ const connect = (username) => { | |||
| State.websocket.onmessage = (e) => { | |||
| const message = JSON.parse(e.data) | |||
| if(message.online) { | |||
| const difference = (l1, l2) => l1.filter(u => !l2.includes(u)) | |||
| difference(message.online, State.online).forEach(username => | |||
| State.posts.push({ts: message.ts, value: `${username} joined`})) | |||
| difference(State.online, message.online).forEach(username => | |||
| State.posts.push({ts: message.ts, value: `${username} left`})) | |||
| } | |||
| if(!doNotLog.has(message.kind)) { | |||
| console.log(message) | |||
| } | |||