HomeHelp CenterEvents Guide

Events Guide

All Available Events

The SDK provides the following events, accessible through VmosEdgeClientEvents constants:

Event Name Constant Description Event Data
Size Changed SIZE_CHANGED Triggered when video stream size or rotation changes VmosEdgeSizeChangedEvent
Error ERROR Triggered when an error occurs VmosEdgeErrorEvent
Connection Success STARTED Triggered when connection is established and video stream starts playing void (no data)
Connection Stopped STOPPED Triggered when client stops running (active stop or critical error) void (no data)
Clipboard Changed CLIPBOARD_CHANGED Triggered when device clipboard content changes string (clipboard content)
Channel Connected CHANNEL_CONNECTED Triggered when a single channel (video/audio/touch) connection is established VmosEdgeChannelConnectedEvent
Group Control Device Joined GROUP_CONTROL_JOINED Triggered when a slave device successfully joins the group control group VmosEdgeClientConfig
Group Control Device Left GROUP_CONTROL_LEAVE Triggered when a slave device leaves the group control group VmosEdgeClientConfig

Event Usage Examples

import {
  VmosEdgeClient,
  VmosEdgeClientEvents,
  type VmosEdgeErrorEvent,
  type VmosEdgeSizeChangedEvent,
} from "@vmosedge/web-sdk";

const client = new VmosEdgeClient({ /* ... */ });

// Connection success
client.on(VmosEdgeClientEvents.STARTED, () => {
  console.log("✅ Device connected successfully, screen is ready");
});

// Connection stopped
client.on(VmosEdgeClientEvents.STOPPED, () => {
  console.log("⏹️ Connection stopped");
});

// Error handling
client.on(VmosEdgeClientEvents.ERROR, (error: VmosEdgeErrorEvent) => {
  console.error(`❌ Error occurred [${error.code}]: ${error.message}`);
  
  // Handle different error types
  switch (error.type) {
    case "connection":
      console.error("Connection error, please check network and device status");
      break;
    case "video":
      console.error("Video stream error, please check video port");
      break;
    case "touch":
      console.error("Touch channel error, please check touch port");
      break;
  }
});

// Size change
client.on(
  VmosEdgeClientEvents.SIZE_CHANGED,
  (size: VmosEdgeSizeChangedEvent) => {
    console.log(`📐 Screen size changed: ${size.videoWidth} x ${size.videoHeight}`);
    console.log(`🔄 Rotation state: ${size.rotation === 0 ? "Portrait" : "Landscape"}`);
  }
);

// Clipboard change
client.on(VmosEdgeClientEvents.CLIPBOARD_CHANGED, (content: string) => {
  console.log(`📋 Clipboard content changed: ${content}`);
});

// Channel connection
client.on(VmosEdgeClientEvents.CHANNEL_CONNECTED, (event) => {
  console.log(`🔌 ${event.channel} channel connected successfully`);
});
Quick customer support
Download