feature(sender): adapted relay and sender component to work with a simple transfer name
In order to be able to use a simple transfer name, the relay server and the sender were adapted. On the sender, the on_create_room method was adapted so that a call is made to the http_client to register the transfer with the relay server. The handle_create_room method on the server has been adapted so that when a room is created, the name is transmitted by the receiver and is no longer generated on the relayserver.This was also done in preparation for integrating a local relayserver for the direct connection between sender and receiver.
This commit is contained in:
parent
9f7b95ca98
commit
336ea18ad9
11 changed files with 88 additions and 41 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use axum::extract::ws::Message;
|
||||
use axum::extract::ws::{Message, WebSocket};
|
||||
use futures_util::stream::SplitSink;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
|
|
@ -24,7 +24,7 @@ use tokio::sync::Mutex;
|
|||
//
|
||||
// The type alias is used so that the type is not mentioned every time it is
|
||||
// used. This makes the code easier to read and understand.
|
||||
type Sender = Arc<Mutex<SplitSink<axum::extract::ws::WebSocket, Message>>>;
|
||||
type Sender = Arc<Mutex<SplitSink<WebSocket, Message>>>;
|
||||
|
||||
/// A `Room` is a collection of clients that are connected to each other.
|
||||
///
|
||||
|
|
@ -41,7 +41,7 @@ type Sender = Arc<Mutex<SplitSink<axum::extract::ws::WebSocket, Message>>>;
|
|||
/// When a room reaches its maximum size, no more clients can join the room.
|
||||
/// This is used to prevent rooms from getting too full and causing the
|
||||
/// server to run out of memory.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Room {
|
||||
pub senders: Vec<Sender>,
|
||||
pub size: usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue