decentralised sync engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: sessions map use whole object

serenity ed72bc70 58ae5416

+5 -4
+5 -4
src/lib/sessions.ts
··· 54 54 } 55 55 }; 56 56 57 + // map of session tokens to session info objects 57 58 export const issuedLatticeTokens = new Map<string, LatticeSessionInfo>(); 58 59 59 60 export const issueNewLatticeToken = ({ ··· 77 78 return sessionInfo; 78 79 }; 79 80 80 - export const activeSessions = new Map<string, WebSocket>(); 81 + export const activeLatticeSessions = new Map<LatticeSessionInfo, WebSocket>(); 81 82 82 83 export const isValidSession = (sessionInfo: LatticeSessionInfo) => { 83 84 return ( ··· 98 99 } catch { 99 100 return { ok: false }; 100 101 } 101 - activeSessions.set(sessionInfo.id, socket); 102 + activeLatticeSessions.set(sessionInfo, socket); 102 103 return { ok: true, data: { sessionSocket: socket } }; 103 104 }; 104 105 105 106 export const deleteSession = ( 106 107 sessionInfo: LatticeSessionInfo, 107 108 ): Result<undefined, undefined> => { 108 - if (!activeSessions.has(sessionInfo.id)) return { ok: false }; 109 + if (!activeLatticeSessions.has(sessionInfo)) return { ok: false }; 109 110 try { 110 - activeSessions.delete(sessionInfo.id); 111 + activeLatticeSessions.delete(sessionInfo); 111 112 } catch { 112 113 return { ok: false }; 113 114 }