This commit is contained in:
jusax23 2023-10-05 21:19:28 +02:00
parent a1b29106ad
commit 229211689a
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -18,10 +18,14 @@ pub struct QuadWs {
channel: WsChannnel, channel: WsChannnel,
} }
impl QuadWs { impl QuadWs {
pub fn new(url: String) -> Self { pub fn new(url: String) -> Option<Self> {
Self { let conn = ws_open_rust(url);
channel: ws_open_rust(url).unwrap() if conn.is_none() {
return None;
} }
Some(Self {
channel: conn.unwrap(),
})
} }
pub fn write(&mut self, data: Vec<u8>) -> bool { pub fn write(&mut self, data: Vec<u8>) -> bool {
ws_write_rust(&mut self.channel, data) ws_write_rust(&mut self.channel, data)