This page is translated into your preferred language using AI. You can help improve the translation of this wiki! Visit the wiki’s repo

API Explanation

This page is out-of-date. You must see version on Russian, to view all new information
This page needs to be expanded and simplified. You can contribute by editing this page on the this site's repository

Data Types and Their Purpose

This section lists the standard data types from the System.Net.WebSockets namespace in .NET Framework 4.8. For more details on available data types and their purposes, see the official documentation. For simplicity, the System.Net.WebSockets prefix is omitted in the following examples.
When connecting to the main server:
  • WebSocketMessageType.Binary is used to send video when a Paint event fires or upon a user request for a page screenshot.
    Data is sent as an unmarked byte array.
    Data may be compressed with GZip or sent uncompressed, depending on the VideoStreamSettings/UseVideoGzipCompress setting in settings.xml.
  • WebSocketMessageType.Text is used to send textual messages. Text messages contain JSON data, which may include browser state information and some marked-up images.
When connecting to the audio transmission server:
  • WebSocketMessageType.Binary is used to send audio data.
    Data is sent as a marked byte array.
    Regardless of settings, each packet always includes a fixed-size 12-byte header consisting of two fields:
    • uint (4 bytes) — packet sequence number (32-bit integer)
    • ulong (8 bytes) — timestamp in nanoseconds (64-bit integer)
    After the header comes the stream of PCM audio data.
    The sample rate may be reduced to save data under the AudioStreamSettings/AudioSampleRate and AudioStreamSettings/UseAudioResampling settings in settings.xml.
    Data may be compressed with GZip or sent uncompressed, depending on the AudioStreamSettings/UseAudioGzipCompress setting in settings.xml.

Text Data Packet

A packet has the following format:
{
    PType: int32|string,  // packet type
    PData: string,        // packet data as a string: JSON with browser state or marked-up image, or a plain text message
}
The PType field may take the following values depending on the packet’s destination.
If sent from server to client and PType is int32:
  • 0 (NavigatedUrl) — current URL info
  • 1 (TextInputContent) — current content in the active input field
  • 2 (TextInputSend) — sent input text (not used)
  • 3 (TextInputCancel) — no data; indicates the field no longer exists or is inactive
  • 4 (LoadingStateChanged) — page loading state (LOADING or COMPLETE)
  • 5 (OpenPages) — open pages list; entries separated by ;, each entry: Title|Id
  • 6 (EditOpenTabTitle) — current tab title; format Id|NewTitle
  • 7 (IsClientCanSendGoBackRequest)true/false indicating back navigation availability
  • 8 (IsClientCanSendGoForwardRequest)true/false indicating forward navigation availability

Custom PType values without numeric IDs (they are string):
  • FullPageScreenshot
    • ChunkIndex (int) — zero-based chunk index
    • TotalChunks (int) — total number of chunks
    • Data (string) — Base64 image data (no GZip)
  • TabScreenshot
    • TabId (long) — target tab ID
    • Data (string) — Base64 image data (no GZip)
Note: PType may be either int32 or string. Check the data type to avoid processing errors.

FullPageScreenshot and TabScreenshot have no compression settings, but you can adjust image quality via VideoStreamSettings/FullPageScreenshotQuality in settings.xml.

If sent from client to server [PType is always int32]:
  • 0 (Navigation) — send a URL or search text; prefix with skipchk: to skip URL validation. The BrowserSettings/SearchSystem setting in settings.xml controls fallback search engine.
  • 1 (SizeChange) — resize browser window to new Size (Width, Height), multiplied by scalingFactor from VideoStreamSettings/ScalingFactor.
  • 2 (TouchDown) — send a touch-down event as PointerPacket.
  • 3 (TouchUp) — send a touch-up event as PointerPacket.
  • 4 (TouchMoved) — send a touch-move event; PointerPacket has px, py, and id.
  • 5 (ACK) — send ACK packet; server ignores it.
  • 6 (Frame) — server ignores it.
  • 7 (TextInputSend) — send text to active element and press 0x0D.
  • 8 (NavigateForward) — navigate forward if possible.
  • 9 (NavigateBack) — navigate back if possible.
  • 10 (SendKey) — send a keycode (int) to the active input.
  • 11 (RequestFullPageScreenshot) — request a full-page screenshot.
  • 12 (ModeChange) — send Static or Dynamic mode.
  • 13 (SetActivePage) — activate tab by ID and request its snapshot.
  • 14 (GetTabsOpen) — request list of open tabs.
  • 15 (CloseTab) — close tab by ID; if none remain, open FirstRunUrl (BrowserSettings/FirstRunUrl).
  • 16 (RequestTabScreenshot) — request a screenshot of the specified tab.
  • 17 (OpenUrlInNewTab) — open URL in new tab without validation.
  • 18 (NewScreenShotRequest) — force send screenshot to client.
  • 19 (IsCanGoBack) — request back-navigation availability; ignored by server.
  • 20 (IsCanGoForward) — request forward-navigation availability; ignored by server.
  • 21 (SendKeyCommand) — send a specific key action (Enter/Backspace).
  • 22 (SendChar) — send a character via KeyCharPacket (JSONData, Shift, Ctrl, Alt, Layout).