Vagon
HomePricingGo to Dashboard
Vagon Streams
Vagon Streams
  • Introduction
  • Unreal Engine Pixel Streaming
  • Unity Render Streaming
  • Vagon Application Streaming
    • Application Bundles
  • Guides
    • How to Start Streaming
    • Performance Types
    • Streams
    • Capacity Types
    • Worldwide Coverage
    • Connection Optimizations
      • Application Cache Memory
      • Region Optimization
  • Configurations
    • Premium Feature Plans
    • Application Versioning
    • Basics
    • Limitations
    • Accessibility
    • Availability
    • Launch Parameters
    • Visitor Data Collection
    • Customize - Connection Page
    • Stream Files
    • Advanced
    • Application Budget Limit
  • Integrations
    • Client-side Communication
      • Javascript SDK
      • Unreal Engine SDK
      • Unity SDK
    • URL Parameters
    • Streams API Services
      • Authentication
      • API Documentation
  • Custom Flows
    • Connect over Corporate Networks
    • Run Multiple Files & Scripts
    • Application Debugging
    • Multi Tenant Streaming
    • Multiplayer Experiences
    • Troubleshooting
  • Tools & Services
    • AWS Marketplace
    • Vagon Streams CLI
    • Unity Verified Plugin
Powered by GitBook
On this page
  • How to Setup Websocket Connection in Unity
  • Predefined Actions
  • Show On-Screen Keyboard Button
  • Hide On-Screen Keyboard Button
  • Enable 360 View Mode
  • Disable 360 View Mode
  • Keep Stream Alive - Reset Idle Timer
  • Turn Off Stream Machine
  • Resize Frame / Stream
  • Set Streaming Quality
  • Request Session Information
  • Request Machine ID
  • Returned Objects
  • Session Information Event
  • Connection Information
  • Machine ID Information Event
  1. Integrations
  2. Client-side Communication

Unity SDK

PreviousUnreal Engine SDKNextURL Parameters

Last updated 9 months ago

To establish a connection between your Unity application and your client-side. You have to establish a websocket connection first.

Connect to websocket url ws://localhost:7788/ using your engine's built-in websocket client.

After establishing the connection, the messages you send to the websocket will be received on the JS side and vice-versa.

How to Setup Websocket Connection in Unity

Predefined Actions

Open Link in a New Browser Page

You can initiate action to open a specific URL from the default browser of your visitor from inside your application. You should send a Websocket message by following the format below, message should be JSON formatted plain text message.

{
  "$type": "8",
  "Url": "https://www.vagon.io"
}

Show On-Screen Keyboard Button

If your visitors are using your Applications on mobile/tablet devices, you can also allow them to type with the on-screen keyboard inside Vagon Streams. The good part is, you can manage the visibility of the on-screen keyboard button directly from your application, and trigger actions to show the keyboard button when the visitor focuses on an input inside the application. To show the On Screen Keyboard Button, you should send a Websocket message by following the format below, message should be JSON formatted plain text message.

{\"$type\":\"9\"}
{
  "$type": "9"
}

Hide On-Screen Keyboard Button

When the focus changes from the input, you can hide the on-screen keyboard button from the screen as well. Again, you should send a Websocket message by following the format below, message should be JSON formatted plain text message.

{\"$type\":\"10\"}
{
  "$type": "10"
}

Enable 360 View Mode

Independently from Application Configurations, you can enable 360 View Mode inside your application by sending the following message via Websocket.

After sending this message, 360 View Mode will be activated with the first mouse click on Stream.

{\"$type\":\"11\"}
{
  "$type": "11"
}

Disable 360 View Mode

Independently from Application Configurations, you can disable 360 View Mode inside your application by sending the following message via Websocket.

{\"$type\":\"12\"}
{
  "$type": "12"
}

Keep Stream Alive - Reset Idle Timer

When the Idle Duration Limit is active, you can reset the Idle Timer by sending the message below via Websocket.

{\"$type\":\"13\"}
{
  "$type": "13"
}

Turn Off Stream Machine

You can send the following message via Websocket to turn off the Stream Machine which is running the related application.

{\"$type\":\"14\"}
{
  "$type": "14"
}

Resize Frame / Stream

Updates the streaming resolution and matches the iframe height and width when initiated.

{\"$type\":\"16\"}
{
  "$type": "16"
}

Set Streaming Quality

Quality parameters can be set as "standard", "moderate" or "high". Session will be refreshed automatically after the quality is set.

{\"$type\":\"17\",\"Quality\":\"standard\"}
{
  "$type": "17",
  "Quality": "standard"
}

Request Session Information

Triggers the Session Information event, data must be collected via Session Information event.

{\"$type\":\"18\"}
{
  "$type": "18"
}

Request Machine ID

Triggers the Machine ID Information event, data must be collected via Machine ID Information event.

{\"$type\":\"25\"}
{
  "$type": "25"
}

Returned Objects

Message responses will be returned as JSON-formatted string to WebSocket onMessage events. Additional parsing operation may be required.

Session Information Event

{
  "$type": "19",
  "session": {
    "ping": 150,
    "os": "windows",
    "device_type": "desktop",
  },
  "machine": {
    "status": "runinng",
    "friendly_status": "ready",
    "connection_status": "connected",
    "region": "dublin",
    "uid": "05545648-c292-4ef4-b571-d10797f83069",
    "application_id": 1,
    "stream_id": 1,
    "machine_id": 1,
  }
}

Connection Information

isConnected returns true when user joins to the Session, returns false when leaves the session.

{
  "$type": "15",
  "isConnected": true
}

Machine ID Information Event

{
  "$type": "26",
  "id": 1
}