session handling for players and hosts

This commit is contained in:
2025-05-17 12:23:19 -06:00
parent fee5576efd
commit b6a4936247
11 changed files with 221 additions and 28 deletions
+13
View File
@@ -6,6 +6,7 @@ import gleam/erlang/process
import gleam/result
import glint
import mist
import player_session
import session
import storail
@@ -30,6 +31,17 @@ pub fn setup_session_collection(
)
}
pub fn setup_player_session_collection(
config: storail.Config,
) -> storail.Collection(player_session.PlayerSession) {
storail.Collection(
name: "PlayerSessions",
to_json: player_session.encode_player_session,
decoder: player_session.player_session_decoder(),
config:,
)
}
pub fn run_server() -> glint.Command(Result(Nil, Error)) {
use <- glint.command_help("Runs the backend of Play of the Game")
use _, args, _ <- glint.command()
@@ -52,6 +64,7 @@ pub fn run_server() -> glint.Command(Result(Nil, Error)) {
web.Context(
config: cfg,
sessions: setup_session_collection(storail_cfg),
player_sessions: setup_player_session_collection(storail_cfg),
selector: process.new_selector(),
)