Constructor
new WebSocketClientParametersBuilder()
Creates a builder with default WebSocket settings.
Initializes the inherited client configuration
and WebSocket-specific properties.
Extends
Classes
Members
agentRegistry :AgentClassRegistry
Type:
- Overrides:
autoStart :boolean
Type:
- boolean
- Overrides:
compressed :boolean
Type:
- boolean
- Overrides:
crcCheck :boolean
Type:
- boolean
- Overrides:
encryptionKey :Uint8Array|null
Type:
- Uint8Array | null
- Overrides:
eventHandlers :Array.<Object>
Event handlers registered with the WebSocket client.
Type:
- Array.<Object>
maxReceiveBufferSize :number
Type:
- number
- Overrides:
serverUrl :string|null
URL of the WebSocket server.
Required before building the configuration.
Type:
- string | null
syncReplyTimeout :number
Maximum time to wait for a synchronous Reply,
in milliseconds.
Default: 7500 milliseconds.
Type:
- number
Methods
addEventHandler(eventHandler) → {this}
Registers an event handler with the WebSocket client.
Multiple handlers may be registered. Each handler
is notified of applicable connection, Agent,
and Reply events.
Parameters:
| Name | Type | Description |
|---|---|---|
eventHandler |
Object | Event handler implementing one or more WebSocket client callbacks. |
Throws:
-
If eventHandler is null or otherwise falsy.
- Type
- Error
Returns:
This builder for method chaining.
- Type
- this
build() → {WebSocketClientParameters}
Validates the configuration and creates
WebSocketClientParameters.
- Overrides:
Throws:
-
If the required server URL has not been configured.
- Type
- Error
Returns:
Configured WebSocket client parameters.
registerAgent(jsClass, javaFqcn) → {this}
Registers a JavaScript Agent class with its
corresponding Java fully qualified class name.
Used to reconstruct the correct JavaScript class
when receiving serialized Agents from KDC-Java.
Parameters:
| Name | Type | Description |
|---|---|---|
jsClass |
function | JavaScript Agent constructor. |
javaFqcn |
string | Fully qualified Java class name. |
- Overrides:
Returns:
This builder for method chaining.
- Type
- this
registerAgents(agentMap) → {this}
Registers multiple Agent classes.
Each Map entry associates a JavaScript constructor
with its corresponding Java fully qualified class name.
Parameters:
| Name | Type | Description |
|---|---|---|
agentMap |
Map.<function(), string> | Map of JavaScript constructors to Java class names. |
- Overrides:
Throws:
-
If agentMap is not a Map.
- Type
- Error
Returns:
This builder for method chaining.
- Type
- this
withCompressed(value) → {this}
Enables or disables GZIP compression.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
boolean | Whether compression is enabled. |
- Overrides:
Returns:
This builder for method chaining.
- Type
- this
withCrcCheck(value) → {this}
Enables or disables CRC checking for Agent packets.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
boolean | Whether CRC checking is enabled. |
- Overrides:
Returns:
This builder for method chaining.
- Type
- this
withEncryptionKey(value) → {this}
Configures the encryption key used for AES-GCM.
A null value disables encryption.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
Uint8Array | null | Raw AES encryption key, or null. |
- Overrides:
Returns:
This builder for method chaining.
- Type
- this
withMaxReceiveBufferSize(value) → {this}
Sets the maximum permitted receive buffer size.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Maximum receive buffer size in bytes. |
Throws:
-
If value is not a positive integer.
- Type
- Error
Returns:
This builder for method chaining.
- Type
- this
withServerUrl(value) → {this}
Sets the WebSocket server URL.
The URL normally uses the ws:// or wss:// scheme.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
string | WebSocket server URL. |
Throws:
-
If value is null or undefined.
- Type
- Error
Returns:
This builder for method chaining.
- Type
- this
withSyncReplyTimeout(value) → {this}
Sets the synchronous Reply timeout.
Determines how long sendSync() waits for a
matching Reply before rejecting the operation.
Parameters:
| Name | Type | Description |
|---|---|---|
value |
number | Timeout in milliseconds. Must be a positive integer. |
Throws:
-
If value is not a positive integer.
- Type
- Error
Returns:
This builder for method chaining.
- Type
- this