servicepoint/examples/websocket.rs
Vinzenz Schroeter a1316b0271 impl Default for CompressionCode
also more feature-agnostic examples
2025-02-17 22:32:45 +01:00

25 lines
559 B
Rust

//! Example for how to use the WebSocket connection
use servicepoint::{
Bitmap, Command, CompressionCode, Connection, Grid, Origin,
};
fn main() {
let connection =
Connection::open_websocket("ws://localhost:8080".parse().unwrap())
.unwrap();
connection.send(Command::Clear).unwrap();
let mut pixels = Bitmap::max_sized();
pixels.fill(true);
connection
.send(Command::BitmapLinearWin(
Origin::ZERO,
pixels,
CompressionCode::default(),
))
.unwrap();
}