servicepoint/examples/websocket.rs
Vinzenz Schroeter 04aa4aa95a
All checks were successful
Rust / build (pull_request) Successful in 2m22s
split language bindings into separate repositories
2025-02-16 17:36:08 +01:00

24 lines
554 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::Lzma,
))
.unwrap();
}