Add UserId newtype and WebSocket ping keep-alive
All checks were successful
CI / ci (push) Successful in 5m57s
All checks were successful
CI / ci (push) Successful in 5m57s
Replace raw String user IDs with a UserId newtype in domain for type safety, and add 30s ping/pong to prevent idle WebSocket disconnects.
This commit is contained in:
@@ -3,7 +3,7 @@ mod common;
|
||||
use std::sync::Arc;
|
||||
|
||||
use application::AppState;
|
||||
use domain::Color;
|
||||
use domain::{Color, UserId};
|
||||
|
||||
fn state_with_persistence(persistence: common::FakePersistence) -> Arc<AppState> {
|
||||
let spy = common::SpyBroadcaster::new();
|
||||
@@ -22,10 +22,11 @@ fn save_snapshot_persists_current_canvas() {
|
||||
let saved_ref = persistence.saved_ref();
|
||||
let state = state_with_persistence(persistence);
|
||||
|
||||
let user = UserId::new("user".to_string());
|
||||
application::canvas::place_pixel::execute(
|
||||
&state,
|
||||
application::canvas::place_pixel::Command {
|
||||
user_id: "user",
|
||||
user_id: &user,
|
||||
position: domain::Position::new(0, 0),
|
||||
color: Color::new(0xFF),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user