summaryrefslogtreecommitdiff
path: root/server/src/network/SessionManager.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-26 17:55:27 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-26 17:55:27 -0600
commit6ce6946a4401d2ee6fa5cb747fab7d4c658a63c8 (patch)
treee60767dc5295edf379cf421e20171dc418e548b7 /server/src/network/SessionManager.ts
parent594921352c8d82fe5f1a6201a4d5f9fbd9b719fc (diff)
downloadjumpstorm-6ce6946a4401d2ee6fa5cb747fab7d4c658a63c8.tar.gz
jumpstorm-6ce6946a4401d2ee6fa5cb747fab7d4c658a63c8.zip
add entity updates over network!
Diffstat (limited to 'server/src/network/SessionManager.ts')
-rw-r--r--server/src/network/SessionManager.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/network/SessionManager.ts b/server/src/network/SessionManager.ts
new file mode 100644
index 0000000..dbd4364
--- /dev/null
+++ b/server/src/network/SessionManager.ts
@@ -0,0 +1,33 @@
+import { Session, SessionManager } from '.';
+
+export class MemorySessionManager implements SessionManager {
+ private sessions: Map<string, Session>;
+
+ constructor() {
+ this.sessions = new Map();
+ }
+
+ public getSessions() {
+ return Array.from(this.sessions.keys());
+ }
+
+ public uniqueSessionId() {
+ return crypto.randomUUID();
+ }
+
+ public getSession(id: string) {
+ return this.sessions.get(id);
+ }
+
+ public putSession(id: string, session: Session) {
+ return this.sessions.set(id, session);
+ }
+
+ public numSessions() {
+ return this.sessions.size;
+ }
+
+ public removeSession(id: string) {
+ this.sessions.delete(id);
+ }
+}