ironrdp-web
WebAssembly high-level bindings for IronRDP targeting web browsers. This crate provides a complete RDP client implementation that runs in the browser using WebAssembly and WebSockets.Overview
Theironrdp-web crate exposes IronRDP functionality to JavaScript/TypeScript through WebAssembly bindings. It handles RDP protocol communication over WebSocket connections and provides APIs for session management, input handling, clipboard operations, and canvas rendering.
Source: crates/ironrdp-web/
Features
- Session Management: Full RDP session lifecycle with connection, rendering, and termination
- Input Handling: Mouse, keyboard, and touch input support
- Clipboard Integration: Bidirectional clipboard with format conversion (text, HTML, images)
- Canvas Rendering: Direct rendering to HTML5 Canvas elements
- Display Control: Dynamic resolution changes via RDP Display Control channel
- CredSSP Authentication: Support for Network Level Authentication
- WebSocket Transport: RDP over WebSocket with optional message size limits
Building
Build the WebAssembly module usingwasm-pack:
Session Builder API
SessionBuilder
Builder for configuring and establishing RDP sessions.Configuration Methods
Required Parameters
Optional Parameters
Extensions
pcb: Pre-Connection Blob for load balancingkdc_proxy_url: Kerberos KDC proxy URL for authenticationdisplay_control: Enable dynamic resolution changesenable_credssp: Toggle CredSSP/NLA (default: true)outbound_message_size_limit: Maximum outbound message size in bytes
Connection
- Opens WebSocket to proxy
- Performs RDCleanPath handshake (if applicable)
- Negotiates RDP protocol (X.224, MCS, RDP)
- Authenticates user (NLA/CredSSP if enabled)
- Establishes RDP session channels
- Returns active Session object
Session API
Session
Represents an active RDP session.Methods
Input Handling
DeviceEvent
Input events from user interaction.Factory Methods
Mouse Buttons
0: Left button1: Middle button2: Right button3-4: Additional buttons
Rotation Units
RotationUnit.Pixel: Raw pixel deltasRotationUnit.Line: Line-based scrolling (× 50 pixels)RotationUnit.Page: Page-based scrolling (× 38 lines × 50 pixels)
InputTransaction
Batch container for input events.Clipboard API
ClipboardData
Represents clipboard content with multiple format items.ClipboardItem
Single clipboard format.Supported MIME Types
text/plain: Plain texttext/html: HTML contentimage/png: PNG images
CF_UNICODETEXT↔text/plainHTML Format/text/html↔ browser HTMLCF_DIB/CF_DIBV5/PNG↔image/png
Cursor Style Callback
The cursor style callback receives the following signature:Cursor Kinds
"default": System default cursor (other args areundefined)"hidden": Hide cursor (other args areundefined)"url": Custom cursor from Base64 data URLdata: PNG data URL (data:image/png;base64,...)hotspot_x,hotspot_y: Cursor hotspot coordinates
Session Termination
SessionTerminationInfo
Information about session end.- User-initiated disconnect
- Server-initiated disconnect
- Network error
- Protocol error
- Graceful shutdown
Error Handling
IronError
All methods returnResult types that throw IronError on failure.
Types
DesktopSize
CursorStyle
Architecture Notes
- Transport: Uses WebSocket with automatic message chunking for large frames
- Rendering: Direct pixel buffer updates to HTML5 Canvas via
softbuffer - Threading: Single-threaded async execution using
wasm-bindgen-futures - Clipboard: Eager format fetching (no delayed rendering due to browser limitations)
- Resize: Requires RDP Display Control channel (DVC); triggers deactivation-reactivation sequence
Example Usage
Related Crates
ironrdp: Core RDP protocol implementationironrdp-connector: Connection establishmentironrdp-session: Session managementironrdp-cliprdr: Clipboard redirection channelironrdp-displaycontrol: Display control channeliron-remote-desktop: Remote desktop abstraction layer

