Learn how to evaluate and integrate the VNC SDK
Viewer¶
-
vncsdk.Viewer¶ A VNC-compatible Viewer showing the screen of and controlling a remote computer.
Nested Classes¶
- class
vncsdk.Viewer.ViewerCanvasContext() vncsdk.Viewer.ConnectionStatusvncsdk.Viewer.DisconnectFlagsvncsdk.Viewer.EncryptionLevelvncsdk.Viewer.MouseButtonvncsdk.Viewer.MouseWheelvncsdk.Viewer.PictureQualityvncsdk.Viewer.AuthenticationCallbackvncsdk.Viewer.ConnectionCallbackvncsdk.Viewer.FramebufferCallbackvncsdk.Viewer.PeerVerificationCallbackvncsdk.Viewer.ServerEventCallback
Constructor Summary¶
| Modifier and Type | Method and Description |
|---|---|
Viewer() Creates and returns a new viewer. |
Method Summary¶
| Modifier and Type | Method and Description |
|---|---|
| Uint8Array or null |
Returns the viewer framebuffer data for the given rectangle. |
A painting function that paints the framebuffer into a canvas, using the most optimised functions that the browser provides. |
|
Destroys the viewer. |
|
|
Disconnects this viewer from the server. |
|
vncsdk.AnnotationManager |
Obtains the Viewer’s |
vncsdk.ConnectionHandler |
Returns the viewer’s |
vncsdk.Viewer.ConnectionStatus |
Returns the status of the viewer’s connection. |
| string or null |
Returns a human-readable message sent by the server for the last disconnection, or |
| string or null |
Returns a string ID representing the reason for the last viewer disconnection. |
vncsdk.Viewer.EncryptionLevel |
Returns the Viewer’s current encryption level. |
vncsdk.MessagingManager |
Obtains the Viewer’s Messaging Manager for handling messaging For more information, see |
| string |
Returns the address of the viewer’s server. |
vncsdk.Viewer.PictureQuality |
Returns the viewer’s current picture quality. |
| number |
Gets the height of the viewer framebuffer. |
vncsdk.PixelFormat |
Gets the pixel format of the viewer framebuffer. |
| number |
Returns the stride of the viewer framebuffer data in pixels, that is, the number of pixels from the start of each row until the start of the next. |
| number |
Gets the width of the viewer framebuffer. |
|
Send key up events for all currently pressed keys. |
|
Provides the SDK with the result of a username/password request. |
|
Copies the given text to the server’s clipboard. |
|
Sends a key down (press) event to the server. |
|
Sends a key up (release) event to the server. |
|
Provides the SDK with the response to the |
|
Sends a pointer event to the server. |
|
Sends a scroll wheel event to the server. |
|
Sets the callback to be called when a username and/or password is required. |
|
Sets the callbacks for the Viewer to call when various events occur during its lifetime. |
|
Sets the desired encryption level of the session from the range of options enumerated by :js:class:`vncsdk.Viewer`_EncryptionLevel. |
|
Sets the framebuffer callback for this viewer. |
|
Sets the callbacks to be called to verify the identity of the peer (server). |
|
Sets the desired picture quality of the session from the range of options enumerated by :js:class:`vncsdk.Viewer`_PictureQuality. |
|
Sets the server event callback for this viewer. |
|
Sets the viewer framebuffer. |
Constructor¶
-
class
vncsdk.Viewer() Creates and returns a new viewer.
For more information, see
vnc_Viewer_create().Throws: vncsdk.VncExceptionon error
Methods¶
-
Viewer.getViewerFbData(x, y, w, h)¶ Returns the viewer framebuffer data for the given rectangle. This method is rarely useful, and is inefficient. Typically, efficient access to the framebuffer is provided by using
Viewer.putViewerFbData()to paint directly into an HTML canvas.Arguments: - x (number) –
- y (number) –
- w (number) –
- h (number) –
Throws: vncsdk.VncExceptionon errorReturn type: Uint8Array or null
-
Viewer.putViewerFbData(x, y, w, h, canvasCtx[, targetX[, targetY]])¶ A painting function that paints the framebuffer into a canvas, using the most optimised functions that the browser provides. It uses a helper class
vncsdk.Viewer.ViewerCanvasContextwhich stores the canvas and buffer context in between calls. TheViewerCanvasContextshould be created once and passed in to each successive call toputViewerFbData(). IftargetXandtargetYare not provided, they default to 0. The viewer’s pixel format must be set to RGBX (ie. little-endianvncsdk.PixelFormat.bgr888).Arguments: - x (number) –
- y (number) –
- w (number) –
- h (number) –
- canvasCtx (
vncsdk.Viewer.ViewerCanvasContext) – - targetX (number) – Defaults to 0
- targetY (number) – Defaults to 0
Throws: vncsdk.VncExceptionon error
-
Viewer.destroy()¶ Destroys the viewer.
For more information, see
vnc_Viewer_destroy().
-
Viewer.disconnect()¶ Disconnects this viewer from the server.
For more information, see
vnc_Viewer_disconnect().Throws: vncsdk.VncExceptionon error
-
Viewer.getAnnotationManager()¶ Obtains the Viewer’s
vncsdk.AnnotationManager()for handling annotation operations.For more information, see
vnc_Viewer_getAnnotationManager().Return type: vncsdk.AnnotationManager
-
Viewer.getConnectionHandler()¶ Returns the viewer’s
vncsdk.ConnectionHandler()for accepting connections.For more information, see
vnc_Viewer_getConnectionHandler().Return type: vncsdk.ConnectionHandler
-
Viewer.getConnectionStatus()¶ Returns the status of the viewer’s connection.
For more information, see
vnc_Viewer_getConnectionStatus().Return type: vncsdk.Viewer.ConnectionStatus
-
Viewer.getDisconnectMessage()¶ Returns a human-readable message sent by the server for the last disconnection, or
nullif the last disconnection was not initiated by the server.For more information, see
vnc_Viewer_getDisconnectMessage().Return type: string or null
-
Viewer.getDisconnectReason()¶ Returns a string ID representing the reason for the last viewer disconnection.
For more information, see
vnc_Viewer_getDisconnectReason().Return type: string or null
-
Viewer.getEncryptionLevel()¶ Returns the Viewer’s current encryption level.
For more information, see
vnc_Viewer_getEncryptionLevel().Return type: vncsdk.Viewer.EncryptionLevel
-
Viewer.getMessagingManager()¶ Obtains the Viewer’s Messaging Manager for handling messaging
For more information, see
vnc_Viewer_getMessagingManager().Return type: vncsdk.MessagingManager
-
Viewer.getPeerAddress()¶ Returns the address of the viewer’s server.
For more information, see
vnc_Viewer_getPeerAddress().Throws: vncsdk.VncExceptionon errorReturn type: string
-
Viewer.getPictureQuality()¶ Returns the viewer’s current picture quality.
For more information, see
vnc_Viewer_getPictureQuality().Return type: vncsdk.Viewer.PictureQuality
-
Viewer.getViewerFbHeight()¶ Gets the height of the viewer framebuffer.
For more information, see
vnc_Viewer_getViewerFbHeight().Return type: number
-
Viewer.getViewerFbPixelFormat()¶ Gets the pixel format of the viewer framebuffer.
For more information, see
vnc_Viewer_getViewerFbPixelFormat().Throws: vncsdk.VncExceptionon errorReturn type: vncsdk.PixelFormat
-
Viewer.getViewerFbStride()¶ Returns the stride of the viewer framebuffer data in pixels, that is, the number of pixels from the start of each row until the start of the next.
For more information, see
vnc_Viewer_getViewerFbStride().Return type: number
-
Viewer.getViewerFbWidth()¶ Gets the width of the viewer framebuffer.
For more information, see
vnc_Viewer_getViewerFbWidth().Return type: number
-
Viewer.releaseAllKeys()¶ Send key up events for all currently pressed keys.
For more information, see
vnc_Viewer_releaseAllKeys().Throws: vncsdk.VncExceptionon error
-
Viewer.sendAuthenticationResponse(ok, user, passwd)¶ Provides the SDK with the result of a username/password request.
For more information, see
vnc_Viewer_sendAuthenticationResponse().Arguments: - ok (boolean) –
- user (string or null) –
- passwd (string or null) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendClipboardText(text)¶ Copies the given text to the server’s clipboard.
For more information, see
vnc_Viewer_sendClipboardText().Arguments: - text (string) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendKeyDown(keysym, keyCode)¶ Sends a key down (press) event to the server.
For more information, see
vnc_Viewer_sendKeyDown().Arguments: - keysym (number) –
- keyCode (number) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendKeyUp(keyCode)¶ Sends a key up (release) event to the server.
For more information, see
vnc_Viewer_sendKeyUp().Arguments: - keyCode (number) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendPeerVerificationResponse(ok)¶ Provides the SDK with the response to the
Viewer.PeerVerificationCallback.verifyPeer()request.For more information, see
vnc_Viewer_sendPeerVerificationResponse().Arguments: - ok (boolean) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendPointerEvent(x, y, buttonState, rel)¶ Sends a pointer event to the server.
For more information, see
vnc_Viewer_sendPointerEvent().Arguments: - x (number) –
- y (number) –
- buttonState (Set<
vncsdk.Viewer.MouseButton>) – - rel (boolean) –
Throws: vncsdk.VncExceptionon error
-
Viewer.sendScrollEvent(delta, axis)¶ Sends a scroll wheel event to the server.
For more information, see
vnc_Viewer_sendScrollEvent().Arguments: - delta (number) –
- axis (
vncsdk.Viewer.MouseWheel) –
Throws: vncsdk.VncExceptionon error
-
Viewer.setAuthenticationCallback(callback)¶ Sets the callback to be called when a username and/or password is required.
For more information, see
vnc_Viewer_setAuthenticationCallback().Arguments: - callback (
vncsdk.Viewer.AuthenticationCallbackor null) –
Throws: vncsdk.VncExceptionon error- callback (
-
Viewer.setConnectionCallback(callback)¶ Sets the callbacks for the Viewer to call when various events occur during its lifetime.
For more information, see
vnc_Viewer_setConnectionCallback().Arguments: - callback (
vncsdk.Viewer.ConnectionCallbackor null) –
Throws: vncsdk.VncExceptionon error- callback (
-
Viewer.setEncryptionLevel(level)¶ Sets the desired encryption level of the session from the range of options enumerated by :js:class:`vncsdk.Viewer`_EncryptionLevel.
For more information, see
vnc_Viewer_setEncryptionLevel().Arguments: - level (
vncsdk.Viewer.EncryptionLevel) –
Throws: vncsdk.VncExceptionon error- level (
-
Viewer.setFramebufferCallback(callback)¶ Sets the framebuffer callback for this viewer.
For more information, see
vnc_Viewer_setFramebufferCallback().Arguments: - callback (
vncsdk.Viewer.FramebufferCallbackor null) –
Throws: vncsdk.VncExceptionon error- callback (
-
Viewer.setPeerVerificationCallback(callback)¶ Sets the callbacks to be called to verify the identity of the peer (server).
For more information, see
vnc_Viewer_setPeerVerificationCallback().Arguments: - callback (
vncsdk.Viewer.PeerVerificationCallbackor null) –
Throws: vncsdk.VncExceptionon error- callback (
-
Viewer.setPictureQuality(quality)¶ Sets the desired picture quality of the session from the range of options enumerated by :js:class:`vncsdk.Viewer`_PictureQuality.
For more information, see
vnc_Viewer_setPictureQuality().Arguments: - quality (
vncsdk.Viewer.PictureQuality) –
Throws: vncsdk.VncExceptionon error- quality (
-
Viewer.setServerEventCallback(callback)¶ Sets the server event callback for this viewer.
For more information, see
vnc_Viewer_setServerEventCallback().Arguments: - callback (
vncsdk.Viewer.ServerEventCallbackor null) –
Throws: vncsdk.VncExceptionon error- callback (
-
Viewer.setViewerFb(pf, width, height, stride)¶ Sets the viewer framebuffer.
For more information, see
vnc_Viewer_setViewerFb().Arguments: - pf (
vncsdk.PixelFormat) – - width (number) –
- height (number) –
- stride (number) –
Throws: vncsdk.VncExceptionon error- pf (