Introduce the ability of creating rooms on the server

This commit is contained in:
Antonio Scandurra 2022-09-23 15:05:32 +02:00
parent 0b1e372d11
commit ebb5ffcedc
12 changed files with 302 additions and 128 deletions

View file

@ -151,6 +151,7 @@ impl Server {
server
.add_request_handler(Server::ping)
.add_request_handler(Server::create_room)
.add_request_handler(Server::register_project)
.add_request_handler(Server::unregister_project)
.add_request_handler(Server::join_project)
@ -593,6 +594,16 @@ impl Server {
Ok(())
}
async fn create_room(
self: Arc<Server>,
request: TypedEnvelope<proto::CreateRoom>,
response: Response<proto::CreateRoom>,
) -> Result<()> {
let room_id = self.store().await.create_room(request.sender_id)?;
response.send(proto::CreateRoomResponse { id: room_id })?;
Ok(())
}
async fn register_project(
self: Arc<Server>,
request: TypedEnvelope<proto::RegisterProject>,