(id, res, xhr = false)
| 10 | } |
| 11 | |
| 12 | add(id, res, xhr = false) { |
| 13 | console.log('adding and sending to %s', id); |
| 14 | res.writeHead(200, { |
| 15 | 'Content-Type': 'text/event-stream', |
| 16 | 'Cache-Control': 'no-cache', |
| 17 | }); |
| 18 | res.write(`eventId: 0\n\n`); |
| 19 | this.sessions[id] = res; |
| 20 | this.sessions[id].xhr = xhr; |
| 21 | } |
| 22 | |
| 23 | locals(id) { |
| 24 | return (this.sessions[id] || { locals: null }).locals; |