Returns summary info for all sessions (used by the REST API).
()
| 157 | |
| 158 | /** Returns summary info for all sessions (used by the REST API). */ |
| 159 | list(): SessionInfo[] { |
| 160 | return [...this.sessions.values()].map((s) => ({ |
| 161 | token: s.token, |
| 162 | userId: s.userId, |
| 163 | created: s.createdAt.toISOString(), |
| 164 | lastActive: s.lastActive.toISOString(), |
| 165 | alive: s.ws !== null && s.ws.readyState === 1 /* OPEN */, |
| 166 | })); |
| 167 | } |
| 168 | |
| 169 | /** Returns summary info for sessions owned by a specific user. */ |
| 170 | listByUser(userId: string): SessionInfo[] { |