wip: state server side; websocket
This commit is contained in:
parent
549aa39e09
commit
91cff202f6
11 changed files with 169 additions and 44 deletions
11
src/user.ml
11
src/user.ml
|
|
@ -223,3 +223,14 @@ let assert_logged request =
|
|||
let assert_not_logged request =
|
||||
if is_logged_in request then Error (`Forbidden, "you shoudn't be logged in")
|
||||
else Ok ()
|
||||
|
||||
(* TODO save states *)
|
||||
|
||||
let state_ht : (string, Shared.State.t) Hashtbl.t = Hashtbl.create 1
|
||||
|
||||
let set_state = Hashtbl.replace state_ht
|
||||
|
||||
let get_state user_id =
|
||||
match Hashtbl.find_opt state_ht user_id with
|
||||
| Some state -> Ok state
|
||||
| None -> Ok (Shared.State.init ())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue