

# Connection Class
<a name="connection-class"></a>

The Connection Class obtained by calling the [`connect` method](dcv-module.md#connect) of the `dcv` module. For an example showing how to use it, see the [Getting started](establish-connection.md#auth-conn) section.

**Topics**
+ [Methods](#methods)

## Methods
<a name="methods"></a>

**Topics**
+ [attachDisplay(win, displayConf) → \$1Promise.<number>\$1Promise.<\$1code: [MultiMonitorErrorCode](dcv-module.md#MultiMonitorErrorCode), message: string\$1>\$1](#attachDisplay)
+ [captureClipboardEvents(enabled, win, displayId) → \$1void\$1](#captureClipboardEvents)
+ [detachDisplay(displayId) → \$1void\$1](#detachDisplay)
+ [disconnect() → \$1void\$1](#disconnect)
+ [disconnectCollaborator(connectionId) → \$1void\$1](#disconnectCollaborator)
+ [enableDisplayQualityUpdates(enable) → \$1void\$1](#enableDisplayQualityUpdates)
+ [enableHighPixelDensity(enable) → \$1void\$1](#enableHighPixelDensity)
+ [enableTimezoneRedirection(enable) → \$1Promise\$1Promise.<\$1code: [TimezoneRedirectionErrorCode](dcv-module.md#TimezoneRedirectionErrorCode), message: string\$1>\$1](#enableTimezoneRedirection)
+ [enterRelativeMouseMode() → \$1void\$1](#enterRelativeMouseMode)
+ [getConnectedDevices() → \$1Promise.<Array.<MediaDeviceInfo>>\$1Promise.<\$1message: string\$1>\$1](#getConnectedDevices)
+ [getFileExplorer() → \$1Promise.<[filestorage](dcv-module.md#filestorage)>\$1Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1>\$1](#getFileExplorer)
+ [getMaxAllowedMonitorDimensions() \$1[MaxDimensionLimits](dcv-module.md#MaxDimensionLimits)\$1](#getMaxAllowedMonitorDimensions)
+ [getServerInfo() → \$1[serverInfo](dcv-module.md#serverInfo)\$1](#getServerInfo)
+ [getScreenshot() → \$1Promise\$1Promise.<\$1code: [ScreenshotErrorCode](dcv-module.md#ScreenshotErrorCode), message: string\$1>\$1](#getScreenshot)
+ [getStats() → \$1[stats](dcv-module.md#stats)\$1](#getStats)
+ [latchModifierKey(key, location, isDown) → \$1boolean\$1](#latchModifierKey)
+ [openChannel(name, authToken, callbacks, namespace) → \$1Promise\$1Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1>\$1](#openChannel)
+ [queryFeature(featureName) → \$1Promise.<\$1enabled: boolean, remote?: string, autoCopy?: boolean, autoPaste?: boolean, serviceStatus?: string, available?: boolean\$1>\$1Promise.<\$1message: string\$1>\$1](#queryFeature)
+ [registerKeyboardShortcuts(shortcuts) → \$1void\$1](#registerKeyboardShortcuts)
+ [requestDisplayConfig(highColorAccuracy) → \$1Promise\$1Promise.<\$1code: [DisplayConfigErrorCode](dcv-module.md#DisplayConfigErrorCode), message: string\$1>\$1](#requestDisplayConfig)
+ [requestDisplayLayout(layout) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1](#requestDisplayLayout)
+ [requestResolution(width, height) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1](#requestResolution)
+ [sendKeyboardEvent(event) → \$1boolean\$1](#sendKeyboardEvent)
+ [sendKeyboardShortcut(shortcut) → \$1void\$1](#sendKeyboardShortcut)
+ [setDisplayQuality(min, maxopt) → \$1void\$1](#setDisplayQuality)
+ [setDisplayScale(scaleRatio, displayId) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1 (DEPRECATED)](#setDisplayScale)
+ [setKeyboardQuirks(quirks) → \$1void\$1](#setKeyboardQuirks)
+ [setMaxDisplayResolution(maxWidth, maxHeight) → \$1void\$1](#setMaxDisplayResolution)
+ [setMicrophone(enable) → \$1Promise\$1Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1>\$1](#setMicrophone)
+ [setMinDisplayResolution(minWidth, minHeight) → \$1void\$1](#setMinDisplayResolution)
+ [setUploadBandwidth(value) → \$1number\$1](#setUploadBandwidth)
+ [setVolume(volume) → \$1void\$1](#setVolume)
+ [setMicrophone(enable, deviceId) → \$1Promise\$1Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1>\$1](#setMicrophone)
+ [setWebcam(enable, deviceId) → \$1Promise\$1Promise.<\$1code: [WebcamErrorCode](dcv-module.md#WebcamErrorCode), message: string\$1>\$1](#setWebcam)
+ [syncClipboards() → \$1boolean\$1](#syncClipboards)

### attachDisplay(win, displayConf) → \$1Promise.<number>\$1Promise.<\$1code: [MultiMonitorErrorCode](dcv-module.md#MultiMonitorErrorCode), message: string\$1>\$1
<a name="attachDisplay"></a>

 Attaches a specific display to a window. You can't attach the main display. If successful, the function returns the `displayId`. 

#### Parameters:
<a name="parameters-1"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Attributes  |  Description  | 
| --- | --- | --- | --- | 
|  win  |  Object  |  The window to which the display must be attached.  | 
|  displayConf  |  Object  |  The configuration of the display. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  displayId  |  number  |  <optional>  |  The ID of the display.  | 
|  displayDivName  |   |   |  The name of the display div.  | 

#### Returns:
<a name="returns"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise.<number> \$1 Promise.<\$1code: [MultiMonitorErrorCode](dcv-module.md#MultiMonitorErrorCode), message: string\$1> 

### captureClipboardEvents(enabled, win, displayId) → \$1void\$1
<a name="captureClipboardEvents"></a>

 Starts or stops listening to copy-paste events. In the case of interactive clipboards (always in the case of paste) we need to start listening to the copy/paste events. It could be useful to start and stop listening only when it is needed, for example, when a modal is shown. 

#### Parameters:
<a name="parameters-2"></a>


|  Name  |  Type  |  Attributes  |  Description  | 
| --- | --- | --- | --- | 
|  enabled  |  boolean  |   |  To start listening to events, specify true. To stop listening to events, specify false.  | 
|  win  |  Object  |  <optional>  |  The window in which to listen for events. If omitted, the default window is used.  | 
|  displayId  |  number  |  <optional>  |  The ID of the display that should listen the events. If omitted, the default display of the window is used.  | 

#### Returns:
<a name="returns-1"></a>

 Type   
 void 

### detachDisplay(displayId) → \$1void\$1
<a name="detachDisplay"></a>

 Detaches a specific display. The main display cannot be detached. 

#### Parameters:
<a name="parameters-3"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  displayId  |  number  |  The ID of the display to detach.  | 

#### Returns:
<a name="returns-2"></a>

 Type   
 void 

### disconnect() → \$1void\$1
<a name="disconnect"></a>

 Disconnects from the Amazon DCV server and closes the connection. 

#### Returns:
<a name="returns-3"></a>

 Type   
 void 

### disconnectCollaborator(connectionId) → \$1void\$1
<a name="disconnectCollaborator"></a>

 Requests disconnect of collaborator connected with the provided connection id (since Amazon DCV Web Client SDK version 1.1.0). 

#### Parameters:
<a name="parameters-4"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  connectionId  |  boolean  |  The id of the connection that will be disconnected.  | 

#### Returns:
<a name="returns-4"></a>

 Type   
 void 

### enableDisplayQualityUpdates(enable) → \$1void\$1
<a name="enableDisplayQualityUpdates"></a>

 Enables or disables display quality updates for streaming areas that do not receive updates. Disabling display quality updates reduces bandwidth usage, but it also decreases the display quality. 

#### Parameters:
<a name="parameters-5"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  To enable display quality updates, specify true. To disable display quality updates, specify false.  | 

#### Returns:
<a name="returns-5"></a>

 Type   
 void 

### enableHighPixelDensity(enable) → \$1void\$1
<a name="enableHighPixelDensity"></a>

 Enables or disables high pixel density on the client. 

#### Parameters:
<a name="parameters-5"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  Whether or not high pixel density should be enabled.  | 

#### Returns:
<a name="returns-5"></a>

 Type   
 void 

### enableTimezoneRedirection(enable) → \$1Promise\$1Promise.<\$1code: [TimezoneRedirectionErrorCode](dcv-module.md#TimezoneRedirectionErrorCode), message: string\$1>\$1
<a name="enableTimezoneRedirection"></a>

 Enables or disables timezone redirection. Once it is enabled, the client requests the server to make the server desktop timezone match the client timezone. 

#### Parameters:
<a name="parameters-5"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  To enable timezone redirection, specify true. To disable timezone redirection, specify false.  | 

#### Returns:
<a name="returns-5"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise.<number> \$1 Promise.<\$1code: [TimezoneRedirectionErrorCode](dcv-module.md#TimezoneRedirectionErrorCode), message: string\$1> 

### enterRelativeMouseMode() → \$1void\$1
<a name="enterRelativeMouseMode"></a>

 Enables relative mouse mode. 

#### Returns:
<a name="returns65"></a>

 Type   
 void 

### getConnectedDevices() → \$1Promise.<Array.<MediaDeviceInfo>>\$1Promise.<\$1message: string\$1>\$1
<a name="getConnectedDevices"></a>

 Requests a list of the media devices connected to the client computer. 

#### Returns:
<a name="returns-7"></a>

 If successful, it returns a Promise that resolves to an array of MediaDeviceInfo objects. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo. If rejected, the promise returns an error object. 

 Type   
 Promise.<Array.<MediaDeviceInfo>> \$1 Promise.<\$1message: string\$1> 

### getFileExplorer() → \$1Promise.<[filestorage](dcv-module.md#filestorage)>\$1Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1>\$1
<a name="getFileExplorer"></a>

 Gets an object to manage the Amazon DCV server's file storage. 

#### Returns:
<a name="returns-8"></a>

 Promise. Resolves to the file explorer object if fulfilled, or an error object if rejected. 

 Type   
 Promise.<[filestorage](dcv-module.md#filestorage)> \$1 Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1> 

### getMaxAllowedMonitorDimensions() \$1[MaxDimensionLimits](dcv-module.md#MaxDimensionLimits)\$1
<a name="getMaxAllowedMonitorDimensions"></a>

 Requests the display dimension limits supported from the Amazon DCV server. 

#### Returns:
<a name="returns-35"></a>

 The object containing maxLargestDimension and maxSmallestDimension supported on webclient by the server. 

 Type   
 [MaxDimensionLimits](dcv-module.md#MaxDimensionLimits) 

### getServerInfo() → \$1[serverInfo](dcv-module.md#serverInfo)\$1
<a name="getServerInfo"></a>

 Gets information about the Amazon DCV server. 

#### Returns:
<a name="returns-9"></a>

 Information about the server software. 

 Type   
 [serverInfo](dcv-module.md#serverInfo) 

### getScreenshot() → \$1Promise\$1Promise.<\$1code: [ScreenshotErrorCode](dcv-module.md#ScreenshotErrorCode), message: string\$1>\$1
<a name="getScreenshot"></a>

 Retrieves the screenshot of the remote desktop in PNG format. The screenshot will be returned in the [screenshotCallback](dcv-module.md#screenshotCallback) observer. `null` will be returned instead in case of failures. 

#### Returns:
<a name="returns-30"></a>

 Promise that resolves if the request is processed. If rejected we receive an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [ScreenshotErrorCode](dcv-module.md#ScreenshotErrorCode), message: string\$1> 

### getStats() → \$1[stats](dcv-module.md#stats)\$1
<a name="getStats"></a>

 Gets statistics about the Amazon DCV server. 

#### Returns:
<a name="returns-10"></a>

 Information about the streaming statistics. 

 Type   
 [stats](dcv-module.md#stats) 

### latchModifierKey(key, location, isDown) → \$1boolean\$1
<a name="latchModifierKey"></a>

 Sends a single keyboard `keydown` or `keyup` event for an allowed modifier. 

#### Parameters:
<a name="parameters-6"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  key  |  Control \$1 Alt \$1 AltGraph \$1 Meta \$1 OS \$1 Shift  |  The key to send.  | 
|  location  |  KeyboardEvent.location  |  The key's location. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location.  | 
|  isDown  |  boolean  |  If the key event to inject is a keydown (true) or a keyup (false).  | 

#### Returns:
<a name="returns-11"></a>

 If the requested combination is valid, the function returns `true`, otherwise it returns `false`. 

 Type   
 boolean 

### openChannel(name, authToken, callbacks, namespace) → \$1Promise\$1Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1>\$1
<a name="openChannel"></a>

 Opens a custom data channel on the connection if it was created on the Amazon DCV Server. 

#### Parameters:
<a name="parameters-7"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  name  |  string  |  The name of the channel.  | 
|  authToken  |  string  |  The authentication token to use to connect to the channel.  | 
|  callbacks  |  Object  |  The onMessage and onClose callbacks functions to call.  | 
|  namespace  |  string  |  The namespace of the channel. Available since Amazon DCV Web Client SDK 1.2.0 and Amazon DCV Server 2022.1.  | 

#### Returns:
<a name="returns-12"></a>

 Promise. If rejected we receive an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [ChannelErrorCode](dcv-module.md#ChannelErrorCode), message: string\$1> 

### queryFeature(featureName) → \$1Promise.<\$1enabled: boolean, remote?: string, autoCopy?: boolean, autoPaste?: boolean, serviceStatus?: string, available?: boolean\$1>\$1Promise.<\$1message: string\$1>\$1
<a name="queryFeature"></a>

 Queries the status of a specific Amazon DCV server feature. 

#### Parameters:
<a name="parameters-8"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  featureName  |  [feature](dcv-module.md#feature)  |  The name of the feature to query.  | 

#### Returns:
<a name="returns-13"></a>

 Promise. If resolved, the function returns a `status` object that always containes an `enabled` property, and possibly also other properties. If rejected, the function returns an `error` object. 

 Type   
 \$1Promise.<\$1enabled: boolean, remote?: string, autoCopy?: boolean, autoPaste?: boolean, serviceStatus?: string, available?: boolean\$1> \$1 Promise.<\$1message: string\$1> 

### registerKeyboardShortcuts(shortcuts) → \$1void\$1
<a name="registerKeyboardShortcuts"></a>

 Registers keyboard shortcuts. 

#### Parameters:
<a name="parameters-9"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  shortcuts  |  Array.<Object>  |  The array of keys and mappings to register. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  sequence  |  Array.<Object>  |  The keyboard shortcut to register. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  output  |  Array.<Object>  |  The intended action to be performed by the shortcut. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  key  |  KeyboardEvent.key  |  The value of the key pressed by the user. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key.  | 
|  location  |  KeyboardEvent.location  |  The array of keys to send. The location of the key on the keyboard. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location.  | 
|  key  |  KeyboardEvent.key  |  The value of the key pressed by the user. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key.  | 
|  location  |  KeyboardEvent.location  |  The array of keys to send. The location of the key on the keyboard. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location.  | 

#### Returns:
<a name="returns-14"></a>

 Type   
 void 

### requestDisplayConfig(highColorAccuracy) → \$1Promise\$1Promise.<\$1code: [DisplayConfigErrorCode](dcv-module.md#DisplayConfigErrorCode), message: string\$1>\$1
<a name="requestDisplayConfig"></a>

 Requests an updated display config from the Amazon DCV Server. Available since Amazon DCV Web Client SDK 1.1.0 and Amazon DCV Server 2022.0. 

#### Parameters:
<a name="parameters-10"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  highColorAccuracy  |  boolean  |  Whether or not high color accuracy should be requested.  | 

#### Returns:
<a name="returns-15"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [DisplayConfigErrorCode](dcv-module.md#DisplayConfigErrorCode), message: string\$1> 

### requestDisplayLayout(layout) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1
<a name="requestDisplayLayout"></a>

 Requests an updated display layout for the connection. 

#### Parameters:
<a name="parameters-11"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  layout  |  Array.<[Monitor](dcv-module.md#Monitor)>  |  The requested displays in the layout.  | 

#### Returns:
<a name="returns-16"></a>

 Promise. If rejected we receive an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1> 

### requestResolution(width, height) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1
<a name="requestResolution"></a>

 Requests an updated display resolution from the Amazon DCV server. 

#### Parameters:
<a name="parameters-12"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  width  |  number  |  The width to request in pixels. The minimum allowed value is 0.  | 
|  height  |  number  |  The height to request in pixels. The minimum allowed value is 0.  | 

#### Returns:
<a name="returns-17"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1> 

### sendKeyboardEvent(event) → \$1boolean\$1
<a name="sendKeyboardEvent"></a>

 Sends a keyboard shortcut event. For more information about keyboard events, see [ https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent). Valid Keyboard events include: `keydown`, `keypress`, and `keyup`. For more information about these events, see [ https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent\$1events](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#events). 

#### Parameters:
<a name="parameters-13"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  event  |  KeyboardEvent  |  The keyboard event to send.  | 

#### Returns:
<a name="returns-18"></a>

 If the event is not valid, the function returns `false`. If the event is valid, the function returns `true`. 

 Type   
 boolean 

### sendKeyboardShortcut(shortcut) → \$1void\$1
<a name="sendKeyboardShortcut"></a>

 Sends a keyboard shortcut. Use this function to send a full `keydown` or `keyup` sequence. For example, sending Ctrl \$1 Alt \$1 Del sends the `keydown` events for all the keys followed by the `keyup` events. Use this function even if you want to send a single key. 

#### Parameters:
<a name="parameters-14"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  shortcut  |  Array.<Object>  |  The array of keys to send. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  key  |  KeyboardEvent.key  |  The value of the key pressed by the user. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key.  | 
|  location  |  KeyboardEvent.location  |  The array of keys to send. The location of the key on the keyboard. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location.  | 

#### Returns:
<a name="returns-19"></a>

 Type   
 void 

### setDisplayQuality(min, maxopt) → \$1void\$1
<a name="setDisplayQuality"></a>

 Sets the image quality to use for the connection. Valid range is `0` to `100`, with `1` being the lowest image quality and `100` being the highest image quality. Specify `0` to retain the current value. 

#### Parameters:
<a name="parameters-15"></a>


|  Name  |  Type  |  Attributes  |  Description  | 
| --- | --- | --- | --- | 
|  min  |  number  |   |  The minimum image quality.  | 
|  max  |  number  |  <optional>  |  The maximum image quality.  | 

#### Returns:
<a name="returns-20"></a>

 Type   
 void 

### setDisplayScale(scaleRatio, displayId) → \$1Promise\$1Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1>\$1 (DEPRECATED)
<a name="setDisplayScale"></a>

 Deprecated since version 1.3.0. There is no need to set the display scale anymore. Mouse coordinates will be managed automatically internally. 

 Notifies the Amazon DCV that the display is scaled on the client side. Use this to notify the server that it needs to scale mouse events to match the client's display ratio. 

#### Parameters:
<a name="parameters-16"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  scaleRatio  |  float  |  The scaling ratio to use. Must be a strictly positive number.  | 
|  displayId  |  number  |  The ID of the display to scale.  | 

#### Returns:
<a name="returns-21"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [ResolutionErrorCode](dcv-module.md#ResolutionErrorCode), message: string\$1> 

### setKeyboardQuirks(quirks) → \$1void\$1
<a name="setKeyboardQuirks"></a>

 Sets keyboard quirks for the client computer. 

#### Parameters:
<a name="parameters-17"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  quirks  |  Object  |  The keyboard quirks to enable or disable. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/dcv/latest/websdkguide/connection-class.html)  | 
|  macOptionToAlt  |  boolean  |  To map the Option key to Alt for macOS, specify true. Otherwise, specify false.  | 
|  macCommandToControl  |  boolean  |  To map the Command key to Ctrl for macOS, specify true. Otherwise, specify false.  | 

#### Returns:
<a name="returns-22"></a>

 Type   
 void 

### setMaxDisplayResolution(maxWidth, maxHeight) → \$1void\$1
<a name="setMaxDisplayResolution"></a>

 Sets the maximum display resolution to use for the connection. 

#### Parameters:
<a name="parameters-18"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  maxWidth  |  number  |  The maximum display width in pixels. The minimum allowed value is 0.  | 
|  maxHeight  |  number  |  The maximum display height in pixels. The minimum allowed value is 0.  | 

#### Returns:
<a name="returns-23"></a>

 Type   
 void 

### setMicrophone(enable) → \$1Promise\$1Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1>\$1
<a name="setMicrophone"></a>

 Enables or disables the microphone. 

#### Parameters:
<a name="parameters-19"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  To enable the microphone, specify true. To disable the microphone, specify false.  | 

#### Returns:
<a name="returns-24"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1> 

### setMinDisplayResolution(minWidth, minHeight) → \$1void\$1
<a name="setMinDisplayResolution"></a>

 Sets the minimum display resolution to use for the connection. Some applications might require a minimum display resolution. If the minimum required resolution is larger than the maximum resolution supported by the client, a resize strategy is used. Use this function carefully. The resize strategy could cause a less precise mouse and touch input system. 

#### Parameters:
<a name="parameters-20"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  minWidth  |  number  |  The minimum display width in pixels. The minimum allowed value is 0.  | 
|  minHeight  |  number  |  The minimum display height in pixels. The minimum allowed value is 0.  | 

#### Returns:
<a name="returns-25"></a>

 Type   
 void 

### setUploadBandwidth(value) → \$1number\$1
<a name="setUploadBandwidth"></a>

 Sets the maxmimum bandwidth to use for uploading files to the Amazon DCV server. 

#### Parameters:
<a name="parameters-21"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  value  |  number  |  The maximum bandwidth limit in kbps. Valid range is 1024 kbps to 102400 kbps.  | 

#### Returns:
<a name="returns-26"></a>

 - The set bandwidth limit. `null` if the file storage feature is disabled on the server. 

 Type   
 number 

### setVolume(volume) → \$1void\$1
<a name="setVolume"></a>

 Sets the volume level to use for audio. Valid range is 0 to 100, with 0 being the lowest volume and 100 being the highest volume. 

#### Parameters:
<a name="parameters-22"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  volume  |  number  |  The volume level to use.  | 

#### Returns:
<a name="returns-27"></a>

 Type   
 void 

### setMicrophone(enable, deviceId) → \$1Promise\$1Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1>\$1
<a name="setMicrophone"></a>

 [Experimental - might change in the future] Enables or disables the microphone. 

#### Parameters:
<a name="parameters-23"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  To enable the microphone, specify true. To disable the microphone, specify false.  | 
|  deviceId  |  string  |  The device ID of the microphone. If no deviceId is provided, the default deviceId is used.  | 

#### Returns:
<a name="returns-28"></a>

 Promise. If rejected, the promise returns an error object. 

 Type   
 Promise \$1 Promise.<\$1code: [AudioErrorCode](dcv-module.md#AudioErrorCode), message: string\$1> 

### setWebcam(enable, deviceId) → \$1Promise\$1Promise.<\$1code: [WebcamErrorCode](dcv-module.md#WebcamErrorCode), message: string\$1>\$1
<a name="setWebcam"></a>

 Enables or disables the webcam. 

#### Parameters:
<a name="parameters-23"></a>


|  Name  |  Type  |  Description  | 
| --- | --- | --- | 
|  enable  |  boolean  |  To enable the webcam, specify true. To disable the webcam, specify false.  | 
|  deviceId  |  string  |  The device ID of the webcam.  | 

#### Returns:
<a name="returns-28"></a>

 Promise that, if successful, resolves to the attached/detached webcam deviceId. If rejected, the promise returns an error object. 

 Type   
 Promise.<string> \$1 Promise.<\$1code: [WebcamErrorCode](dcv-module.md#WebcamErrorCode), message: string\$1> 

### syncClipboards() → \$1boolean\$1
<a name="syncClipboards"></a>

 Synchronizes the local client clipboard with the remote Amazon DCV server clipboard. Autocopy must be supported by the browser. 

#### Returns:
<a name="returns-29"></a>

 If the clipboards have been synchronized, the function returns `true`. If the clipboards have not been sycnhronized, or if the browser does not support autocopy, the function returns `false`. 

 Type   
 boolean 