Simple voice test
This commit is contained in:
+5
-3
@@ -1,6 +1,7 @@
|
||||
pub mod chunk;
|
||||
pub mod message;
|
||||
pub mod indicator;
|
||||
pub mod message;
|
||||
pub mod voice;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -44,8 +45,9 @@ impl Server {
|
||||
}
|
||||
},
|
||||
|
||||
WsMessage::Binary(b) => {
|
||||
Self::LOGGER.info(format!("Binary message: {b:?}"));
|
||||
WsMessage::Binary(data) => {
|
||||
// Self::LOGGER.info(format!("Binary message: {data:?}"));
|
||||
voice::voice(self, client, data)?;
|
||||
}
|
||||
|
||||
WsMessage::String(s) => {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
use crate::{server::Server, utils::client::Client};
|
||||
use std::sync::Arc;
|
||||
|
||||
crate::logger!(LOGGER "Voice chat");
|
||||
|
||||
pub fn voice(server: &Arc<Server>, client: &Client, data: &[u8]) -> crate::Result<()> {
|
||||
let prefix = (10u16).to_le_bytes();
|
||||
|
||||
let mut payload = Vec::with_capacity(prefix.len() + data.len());
|
||||
payload.extend_from_slice(&prefix);
|
||||
payload.extend_from_slice(data);
|
||||
|
||||
client.send_bin(&payload)?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user