Skip to main content

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

The ironrdp-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 using wasm-pack:
Or use the project automation tool:

Session Builder API

SessionBuilder

Builder for configuring and establishing RDP sessions.

Configuration Methods

Required Parameters
Optional Parameters
Extensions
Supported extensions:
  • pcb: Pre-Connection Blob for load balancing
  • kdc_proxy_url: Kerberos KDC proxy URL for authentication
  • display_control: Enable dynamic resolution changes
  • enable_credssp: Toggle CredSSP/NLA (default: true)
  • outbound_message_size_limit: Maximum outbound message size in bytes

Connection

Performs the full RDP connection sequence:
  1. Opens WebSocket to proxy
  2. Performs RDCleanPath handshake (if applicable)
  3. Negotiates RDP protocol (X.224, MCS, RDP)
  4. Authenticates user (NLA/CredSSP if enabled)
  5. Establishes RDP session channels
  6. 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 button
  • 1: Middle button
  • 2: Right button
  • 3-4: Additional buttons

Rotation Units

  • RotationUnit.Pixel: Raw pixel deltas
  • RotationUnit.Line: Line-based scrolling (× 50 pixels)
  • RotationUnit.Page: Page-based scrolling (× 38 lines × 50 pixels)

InputTransaction

Batch container for input events.
Input transactions are applied atomically to minimize RDP round-trips.

Clipboard API

ClipboardData

Represents clipboard content with multiple format items.

ClipboardItem

Single clipboard format.

Supported MIME Types

  • text/plain: Plain text
  • text/html: HTML content
  • image/png: PNG images
The clipboard backend automatically converts between browser formats and RDP clipboard formats:
  • CF_UNICODETEXT ↔ text/plain
  • HTML Format / text/html ↔ browser HTML
  • CF_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 are undefined)
  • "hidden": Hide cursor (other args are undefined)
  • "url": Custom cursor from Base64 data URL
    • data: PNG data URL (data:image/png;base64,...)
    • hotspot_x, hotspot_y: Cursor hotspot coordinates
Large cursors (> 32×32) are automatically downscaled using Lanczos3 resampling to work within browser limitations.

Session Termination

SessionTerminationInfo

Information about session end.
Possible reasons:
  • User-initiated disconnect
  • Server-initiated disconnect
  • Network error
  • Protocol error
  • Graceful shutdown

Error Handling

IronError

All methods return Result 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

  • ironrdp: Core RDP protocol implementation
  • ironrdp-connector: Connection establishment
  • ironrdp-session: Session management
  • ironrdp-cliprdr: Clipboard redirection channel
  • ironrdp-displaycontrol: Display control channel
  • iron-remote-desktop: Remote desktop abstraction layer