making a mess
This commit is contained in:
parent
c35b9604d1
commit
834de62ba0
1 changed files with 5 additions and 5 deletions
10
src/api.rs
10
src/api.rs
|
@ -11,6 +11,11 @@ use std::{net::SocketAddr, sync::Arc};
|
||||||
pub mod message_handler;
|
pub mod message_handler;
|
||||||
use crate::message_handler::*;
|
use crate::message_handler::*;
|
||||||
|
|
||||||
|
pub struct User {
|
||||||
|
name: String,
|
||||||
|
addr: SocketAddr,
|
||||||
|
}
|
||||||
|
|
||||||
fn greeting(state: &Arc<AppState>) -> String {
|
fn greeting(state: &Arc<AppState>) -> String {
|
||||||
format!(
|
format!(
|
||||||
"{:#?} Card packs loaded\n\
|
"{:#?} Card packs loaded\n\
|
||||||
|
@ -20,11 +25,6 @@ fn greeting(state: &Arc<AppState>) -> String {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct User {
|
|
||||||
name: String,
|
|
||||||
addr: SocketAddr,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn websocket(stream: WebSocket, state: Arc<AppState>, who: User) {
|
pub async fn websocket(stream: WebSocket, state: Arc<AppState>, who: User) {
|
||||||
// By splitting, we can send and receive at the same time.
|
// By splitting, we can send and receive at the same time.
|
||||||
let (mut sender, mut receiver) = stream.split();
|
let (mut sender, mut receiver) = stream.split();
|
||||||
|
|
Loading…
Add table
Reference in a new issue