@elgato/utils 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rpc/client.js +7 -1
- package/package.json +1 -1
package/dist/rpc/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _a;
|
|
1
2
|
import { JsonRpcErrorCode } from "./json-rpc/error.js";
|
|
2
3
|
import { JsonRpcResponse } from "./json-rpc/response.js";
|
|
3
4
|
import {} from "./request.js";
|
|
@@ -6,6 +7,10 @@ import {} from "./response.js";
|
|
|
6
7
|
* Client capable of sending requests to, and receiving responses from, a server.
|
|
7
8
|
*/
|
|
8
9
|
export class RpcClient {
|
|
10
|
+
/**
|
|
11
|
+
* The timeout, in milliseconds, used when the request does not have a timeout specified; default 30 seconds.
|
|
12
|
+
*/
|
|
13
|
+
static #DEFAULT_TIMEOUT = 30000;
|
|
9
14
|
/**
|
|
10
15
|
* The client's options.
|
|
11
16
|
*/
|
|
@@ -119,7 +124,7 @@ export class RpcClient {
|
|
|
119
124
|
*/
|
|
120
125
|
async #sendRequest(request) {
|
|
121
126
|
const id = crypto.randomUUID();
|
|
122
|
-
const { method, params, timeout } = request;
|
|
127
|
+
const { method, params, timeout = _a.#DEFAULT_TIMEOUT } = request;
|
|
123
128
|
// Initialize the response handler.
|
|
124
129
|
const response = new Promise((resolve) => {
|
|
125
130
|
this.#requests.set(id, (res) => {
|
|
@@ -141,3 +146,4 @@ export class RpcClient {
|
|
|
141
146
|
return response;
|
|
142
147
|
}
|
|
143
148
|
}
|
|
149
|
+
_a = RpcClient;
|