Skip to content

About

Just compile ironrdp_web to wasm

Resources

Stars

17 stars

Watchers

0 watching

Forks

Repository files navigation

IronRDP WASM

English 中文

WebAssembly build of IronRDP for browser-based RDP clients.

Features

  • RDP Connection - Connect to RDP servers directly from the browser
  • Input Handling - Keyboard, mouse, and wheel support with PS/2 Set 1 scancode mapping
  • Clipboard Sync - Text clipboard synchronization between local and remote
  • File Transfer - Upload and download files via CLIPRDR channel
    • Drag & drop or file picker to upload files to remote desktop
    • Download files copied on remote server explorer
  • WebSocket Proxy - Example proxy server (example/lib/rdp-proxy.js) for RDCleanPath protocol

Quick Start

npm install
npm run build
npm run example

Open http://localhost:8080 in your browser.

Project Structure

ironrdp-wasm/
├── src/
│   └── lib.rs              # Rust WASM bindings
├── pkg/                    # Build output (generated)
│   ├── rdp_client.js       # JavaScript bindings
│   ├── rdp_client_bg.wasm  # Compiled WebAssembly
│   └── rdp_client.d.ts     # TypeScript definitions
├── example/
│   ├── index.html          # Demo RDP client UI
│   ├── style.css           # Styles
│   ├── server.js           # HTTP + WebSocket proxy server
│   └── lib/
│       ├── logger.js       # Logging and status utilities
│       ├── input.js        # Keyboard/mouse input handlers
│       ├── clipboard.js    # Clipboard synchronization
│       ├── file-transfer.js # File upload/download via CLIPRDR
│       ├── session.js      # Session manager (ties everything together)
│       └── rdp-proxy.js    # WebSocket RDCleanPath proxy
├── Cargo.toml
└── package.json

Prerequisites

Rust Toolchain

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown

wasm-pack

cargo install wasm-pack

Node.js

Node.js 16+ from nodejs.org or via nvm.

Building

npm install
npm run build

This runs wasm-pack build --target web --out-dir pkg --release, producing:

  • pkg/rdp_client.js - JavaScript bindings
  • pkg/rdp_client_bg.wasm - Compiled WebAssembly
  • pkg/rdp_client.d.ts - TypeScript definitions

npm run build first materializes the IronRDP checkout the package is built from: it downloads the revision pinned in bin/prepare-ironrdp.js into .ironrdp/ (gitignored) and applies the patches in patches/ (see patches/README.md for what they change and why). The crate is then compiled from a scratch copy in .build/ (gitignored) whose manifest points at that checkout, so no tracked file is modified and an interrupted build cannot leave the working tree in a broken state. Deleting .ironrdp/ forces a clean re-fetch.

Note that the patched checkout carries its own rust-toolchain.toml, so the toolchain version IronRDP pins is the one used.

For debug builds:

wasm-pack build --target web --out-dir pkg --dev

(That skips the patch step - use it only for a quick look at unpatched upstream.)

Usage

import init, {
    SessionBuilder,
    DesktopSize,
    Extension,
    DeviceEvent,
    InputTransaction,
    ClipboardData,
} from 'ironrdp-wasm';

await init();

const builder = new SessionBuilder();
builder.username('user');
builder.password('pass');
builder.destination('rdp-server:3389');
builder.proxyAddress('ws://localhost:8080');
builder.desktopSize(new DesktopSize(1280, 720));
builder.renderCanvas(canvasElement);

const session = await builder.connect();
session.run();

Extensions

IronRDP uses an extension system for optional features:

// Enable CredSSP
builder.extension(new Extension('enable_credssp', true));

// File transfer callbacks
builder.extension(new Extension('files_available_callback', (files, clipDataId) => {
    // Remote has files available for download
}));

// Clipboard callbacks
builder.remoteClipboardChangedCallback((clipboardData) => {
    // Remote clipboard changed
});

builder.forceClipboardUpdateCallback(() => {
    // Sync local clipboard to remote
});

Example Application

The example/ folder contains a complete demo with:

  • Modern dark-themed UI with connection bar, canvas, log panel, and file transfer panel
  • Modular JavaScript architecture (logger.js, input.js, clipboard.js, file-transfer.js, session.js)
  • WebSocket proxy server for RDCleanPath protocol

To run:

cd example && npm install && cd ..
npm run build
npm run example

Credits

This package is a WebAssembly compilation of Marc-André Moreau's IronRDP library. All RDP protocol implementation and core functionality is from the original IronRDP project. This package provides the build tooling and JavaScript bindings to make IronRDP available for web projects.

License

MIT

About

Just compile ironrdp_web to wasm

Resources

Stars

17 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages