Add WIP websocket to controller and refactor settings
This commit is contained in:
parent
452454f9e8
commit
32c75ad73a
11 changed files with 128 additions and 37 deletions
emgauwa-lib/src/handlers/v1/ws
|
@ -25,6 +25,7 @@ impl StreamHandler<Result<Message, ProtocolError>> for ControllerWs {
|
|||
fn handle(&mut self, msg: Result<Message, ProtocolError>, ctx: &mut Self::Context) {
|
||||
let schedules = futures::executor::block_on(get_schedules(&mut self.pool)).unwrap();
|
||||
let schedules_json = serde_json::to_string(&schedules).unwrap();
|
||||
println!("{:?}", msg);
|
||||
match msg {
|
||||
Ok(Message::Ping(msg)) => ctx.pong(&msg),
|
||||
Ok(Message::Text(_text)) => ctx.text(schedules_json),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue