Shoutbox #7

Open
opened 2025-10-27 15:39:12 +00:00 by vxfemboy · 0 comments
vxfemboy commented 2025-10-27 15:39:12 +00:00 (Migrated from github.com)

Shoutbox

WebSocket Client in WASM

Goal: Move shoutbox client logic from JavaScript to Rust/WASM

Implementation:

  • Use web-sys::WebSocket in WASM module
  • Create ShoutboxClient struct in src/mods/wasm.rs
  • Handle message serialization/deserialization in Rust
  • Manage connection state, reconnection logic in WASM

Benefits:

  • Type safety
  • Shared message types between client/server
  • Better error handling
  • Smaller JavaScript footprint

Unified Message Protocol

Create shared types:

// In src/mods/shoutbox_protocol.rs
#[derive(Serialize, Deserialize)]
pub enum ShoutboxMessage {
    NewMessage { username: String, content: String },
    MessageList(Vec),
    UserCount(usize),
    Error(String),
}

future improvements 🤔

  • IRC daemon integration
  • /nick commands
## Shoutbox ### WebSocket Client in WASM **Goal**: Move shoutbox client logic from JavaScript to Rust/WASM **Implementation**: - Use `web-sys::WebSocket` in WASM module - Create `ShoutboxClient` struct in `src/mods/wasm.rs` - Handle message serialization/deserialization in Rust - Manage connection state, reconnection logic in WASM **Benefits**: - Type safety - Shared message types between client/server - Better error handling - Smaller JavaScript footprint ### Unified Message Protocol **Create shared types**: ```rust // In src/mods/shoutbox_protocol.rs #[derive(Serialize, Deserialize)] pub enum ShoutboxMessage { NewMessage { username: String, content: String }, MessageList(Vec), UserCount(usize), Error(String), } ``` ### future improvements 🤔 - IRC daemon integration - `/nick` commands
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vxfemboy/zoa.sh#7
No description provided.