Community.MarcusW.VncClient.Blazor 2.0.3

dotnet add package Community.MarcusW.VncClient.Blazor --version 2.0.3
                    
NuGet\Install-Package Community.MarcusW.VncClient.Blazor -Version 2.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Community.MarcusW.VncClient.Blazor" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Community.MarcusW.VncClient.Blazor" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Community.MarcusW.VncClient.Blazor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Community.MarcusW.VncClient.Blazor --version 2.0.3
                    
#r "nuget: Community.MarcusW.VncClient.Blazor, 2.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Community.MarcusW.VncClient.Blazor@2.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Community.MarcusW.VncClient.Blazor&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Community.MarcusW.VncClient.Blazor&version=2.0.3
                    
Install as a Cake Tool

MarcusW.VncClient.Blazor

Blazor Server adapter for the MarcusW.VncClient library. Enables VNC client functionality in Blazor Server applications with real-time SignalR communication.

⚠️ Important: This package supports Blazor Server ONLY. WebAssembly is NOT supported because VNC requires direct TCP socket connections, which browsers cannot provide due to security restrictions.

🌟 Features

  • Blazor Server: Real-time VNC rendering via SignalR
  • JavaScript Interop: Efficient canvas-based rendering
  • Component-Based: Clean Razor component architecture
  • Touch Support: Mobile and tablet friendly interactions
  • Responsive Design: Adapts to different screen sizes
  • Circuit Safe: Handles Blazor circuit disconnections gracefully

🚀 Quick Start

1. Install Package

<PackageReference Include="Community.MarcusW.VncClient.Blazor" Version="2.0.0" />

2. Add to Razor Component

@page "/vnc"
@using MarcusW.VncClient.Blazor

<VncViewer Connection="@vncConnection" 
           Width="800" 
           Height="600" 
           OnConnectionStateChanged="HandleConnectionState" />

@code {
    private RfbConnection? vncConnection;
    
    protected override async Task OnInitializedAsync()
    {
        await ConnectToVncServer();
    }
    
    private async Task ConnectToVncServer()
    {
        var vncClient = new VncClient(loggerFactory);
        var parameters = new ConnectParameters
        {
            TransportParameters = new TcpTransportParameters
            {
                Host = "your-vnc-server.com",
                Port = 5900
            },
            AuthenticationHandler = new YourAuthHandler()
        };
        
        vncConnection = await vncClient.ConnectAsync(parameters);
    }
    
    private void HandleConnectionState(ConnectionState state)
    {
        // Handle state changes
        InvokeAsync(StateHasChanged);
    }
}

3. Configure Services

// Program.cs (Blazor Server only)
builder.Services.AddVncClientServices();

🎮 Component Features

  • Canvas Rendering: High-performance HTML5 canvas display
  • Input Handling: Mouse, keyboard, and touch event processing
  • Scaling Options: Multiple scaling modes for different screen sizes
  • Connection Management: Built-in connection state visualization
  • Error Boundaries: Graceful error handling and recovery
  • Clipboard Integration: Copy/paste between browser and remote session
  • Special Key Capture: System-level shortcuts forwarded to remote session

⌨️ Keyboard Input & Special Keys

The component provides comprehensive keyboard input support with a Special Keys Menu to overcome browser limitations.

✅ Regular Keyboard Input:

  • All regular typing (letters, numbers, symbols)
  • Function keys (F1-F12)
  • Navigation keys (arrows, Home, End, Page Up/Down)
  • Clipboard paste (Ctrl+V / Cmd+V)
  • Most Ctrl+ key combinations
  • Ctrl+Alt+T - Terminal (Linux)
  • Ctrl+Alt+Arrow keys - Virtual desktops (Linux)
  • F11 - Fullscreen toggle (sent to remote instead of browser)

⌨️ Special Keys Menu:

For OS-protected shortcuts that cannot be captured via keyboard, use the "⌨️" floating button:

Features:

  • 🎯 Draggable - Click and drag the button to reposition it anywhere on the screen
  • 📌 Stays where you put it - Position is remembered during the session
  • 🔄 Collapsible - Small icon button expands to show menu when clicked
  • Auto-closes - Menu automatically collapses after sending a key combo

Windows Shortcuts:

  • Ctrl+Alt+Delete - Security screen
  • Ctrl+Shift+Esc - Task Manager
  • Alt+F4 - Close window
  • Alt+Tab - Switch window
  • Win+R - Run dialog
  • Win+D - Show desktop
  • Win+E - File Explorer
  • Win+L - Lock screen

Linux Shortcuts:

  • Ctrl+Alt+T - Terminal
  • Ctrl+Alt+F1-F7 - TTY switching

These menu items programmatically send the key combinations directly to the VNC server, bypassing browser keyboard event limitations.

💡 How It Works:

  • Typing on keyboard: Captured and sent in real-time (except OS-protected shortcuts)
  • Special Keys menu: Click to send OS-protected shortcuts that can't be typed
  • The menu appears when connected and automatically closes after sending a key combo

🎯 Usage Tips:

  1. Click the canvas to ensure it has focus (blue border when focused)
  2. Type normally for most operations
  3. Use the Special Keys menu for system-level shortcuts (Ctrl+Alt+Del, Win+R, etc.)
  4. Use fullscreen mode for optimal keyboard capture of regular keys

🔧 Advanced Configuration

Component Parameters

<VncViewer Connection="@connection"
           Width="1024"
           Height="768"
           ScaleMode="FitToContainer"
           EnablePointerCapture="true"
           ShowConnectionState="true"
           OnFrameReceived="HandleFrame"
           OnError="HandleError" />

JavaScript Optimization

// Custom rendering optimizations
window.vncClient = {
    optimizeCanvas: function(canvasId) {
        const canvas = document.getElementById(canvasId);
        const ctx = canvas.getContext('2d');
        ctx.imageSmoothingEnabled = false; // Pixel-perfect rendering
    }
};

🌐 Browser Compatibility

  • Chrome/Edge: Full support with optimal performance
  • Firefox: Full support with good performance
  • Safari: Full support (some limitations on older versions)
  • Mobile Browsers: Touch input support with responsive design

⚠️ Why Blazor Server Only?

Technical Limitation: VNC protocol requires direct TCP socket connections to the VNC server. Web browsers (including WebAssembly) cannot create raw TCP sockets due to security restrictions - they can only make HTTP/WebSocket connections.

Blazor Server Solution:

  • VNC connection runs on the server (where TCP sockets are allowed)
  • Real-time updates sent to browser via SignalR
  • Client receives rendered frames and sends input back to server
  • No CORS issues since server handles all VNC communication

🔒 Security Considerations

Since VNC connections are handled server-side, ensure proper authentication and authorization for your Blazor Server application.

📚 Dependencies

This package depends on:

📖 Complete Example

See our Blazor sample application for a complete implementation example.

🤝 Contributing

Contributions welcome! Please see our GitHub repository for guidelines.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.3 99 2/10/2026
2.0.2 96 2/5/2026
2.0.1 103 2/2/2026
2.0.0 100 1/30/2026
2.0.0-alpha9 104 1/22/2026
2.0.0-alpha6 165 11/28/2025
2.0.0-alpha5 196 9/23/2025
2.0.0-alpha4 206 9/23/2025
2.0.0-alpha3 191 9/23/2025
2.0.0-alpha2 189 9/23/2025
2.0.0-alpha1 197 9/23/2025