Expand description
Implementations of AsyncRead
and AsyncWrite
on top of websockets using web-sys
)
§Example
let ws = WebsocketIO::new("localhost:8000").await?;
let (mut reader, mut writer) = ws.split();
writer.write_all(&[0, 1, 2, 3, 93]).await?;
writer.write_all(&[42, 34, 93]).await?;
writer.write_all(&[0, 0, 1, 2, 93]).await?;
let mut buf = Vec::new();
for _ in 0..3 {
reader.read_until(93, &mut buf).await?;
console_log!("{:?}", buf);
buf.clear();
}