mirror of
				https://github.com/csehviktor/status-monitor.git
				synced 2025-08-08 18:06:14 +02:00 
			
		
		
		
	update serialization
This commit is contained in:
		| @@ -1,7 +1,8 @@ | ||||
| use common::StatusMessage; | ||||
| use tokio::sync::{mpsc::Sender, Mutex}; | ||||
|  | ||||
| pub struct ClientManager { | ||||
|     clients: Mutex<Vec<Sender<String>>>, | ||||
|     clients: Mutex<Vec<Sender<StatusMessage>>>, | ||||
| } | ||||
|  | ||||
| impl ClientManager { | ||||
| @@ -11,12 +12,12 @@ impl ClientManager { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     pub async fn add_client(&self, client: Sender<String>) { | ||||
|     pub async fn add_client(&self, client: Sender<StatusMessage>) { | ||||
|         let mut clients = self.clients.lock().await; | ||||
|         clients.push(client); | ||||
|     } | ||||
|  | ||||
|     pub async fn broadcast(&self, message: String) { | ||||
|     pub async fn broadcast(&self, message: &StatusMessage) { | ||||
|         let mut clients = self.clients.lock().await; | ||||
|  | ||||
|         clients.retain(|client| { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user