@2702rebels/ntcore 1.0.1 → 1.0.2
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/index.cjs +13 -8
- package/dist/index.d.cts +201 -201
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +201 -201
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +12 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
let _msgpack_msgpack = require("@msgpack/msgpack");
|
|
2
3
|
let _2702rebels_logger = require("@2702rebels/logger");
|
|
3
|
-
|
|
4
4
|
//#region src/NT4Spec.ts
|
|
5
5
|
/**
|
|
6
6
|
* Network constants.
|
|
7
7
|
*/
|
|
8
8
|
const NetworkSpecs = {
|
|
9
|
+
/** NT4 port for unsecure (ws://) connections */
|
|
9
10
|
portUnsecure: 5810,
|
|
11
|
+
/** NT4 port for secure (wss://) connections */
|
|
10
12
|
portSecure: 5811,
|
|
13
|
+
/** Subprotocol v4.1 */
|
|
11
14
|
protocol41: "v4.1.networktables.first.wpi.edu",
|
|
15
|
+
/** Subprotocol v4.0 */
|
|
12
16
|
protocol40: "networktables.first.wpi.edu",
|
|
17
|
+
/** Subprotocol RTT */
|
|
13
18
|
protocolRTT: "rtt.networktables.first.wpi.edu",
|
|
19
|
+
/** v4.0 ping period in milliseconds */
|
|
14
20
|
pingPeriod40: 1e3,
|
|
21
|
+
/** v4.0 ping timeout in milliseconds */
|
|
15
22
|
pingTimeout40: 3e3,
|
|
23
|
+
/** v4.1 ping period in milliseconds */
|
|
16
24
|
pingPeriod41: 250,
|
|
25
|
+
/** v4.1 ping timeout in milliseconds */
|
|
17
26
|
pingTimeout41: 1e3
|
|
18
27
|
};
|
|
19
28
|
/**
|
|
@@ -38,7 +47,6 @@ const DataTypeCodes = {
|
|
|
38
47
|
"float[]": 19,
|
|
39
48
|
"string[]": 20
|
|
40
49
|
};
|
|
41
|
-
|
|
42
50
|
//#endregion
|
|
43
51
|
//#region src/NT4Subscription.ts
|
|
44
52
|
/** Contains information about NT4 subscription. */
|
|
@@ -55,7 +63,6 @@ var NT4Subscription = class {
|
|
|
55
63
|
this.options = options ?? {};
|
|
56
64
|
}
|
|
57
65
|
};
|
|
58
|
-
|
|
59
66
|
//#endregion
|
|
60
67
|
//#region src/NT4Topic.ts
|
|
61
68
|
/** Contains information about NT4 topic. */
|
|
@@ -127,7 +134,6 @@ var NT4Topic = class {
|
|
|
127
134
|
/** Topic type code. For internal use only. */
|
|
128
135
|
typeCode;
|
|
129
136
|
};
|
|
130
|
-
|
|
131
137
|
//#endregion
|
|
132
138
|
//#region src/NT4WebSocketAsync.ts
|
|
133
139
|
const PROTOCOL_DATA = [NetworkSpecs.protocol41, NetworkSpecs.protocol40];
|
|
@@ -154,7 +160,8 @@ var NT4WebSocketAsync = class {
|
|
|
154
160
|
* @param options connection options
|
|
155
161
|
*/
|
|
156
162
|
constructor(address, port, clientId, options) {
|
|
157
|
-
|
|
163
|
+
const schema = options.secure ? "wss" : "ws";
|
|
164
|
+
this.url = `${schema}://${address}:${port}/nt/${clientId}`;
|
|
158
165
|
this.rtt = options.rtt ?? false;
|
|
159
166
|
this.onMessage = options.onMessage;
|
|
160
167
|
this.onClose = options.onClose;
|
|
@@ -221,7 +228,6 @@ var NT4WebSocketAsync = class {
|
|
|
221
228
|
});
|
|
222
229
|
}
|
|
223
230
|
};
|
|
224
|
-
|
|
225
231
|
//#endregion
|
|
226
232
|
//#region src/NT4Client.ts
|
|
227
233
|
/** Determines whether the specified predicate callback returns true for any element of a map. */
|
|
@@ -828,8 +834,7 @@ var NT4Client = class NT4Client {
|
|
|
828
834
|
else this.pingTimeout_ms = this.dataChannel.protocol === NetworkSpecs.protocol41 ? NetworkSpecs.pingTimeout41 : NetworkSpecs.pingPeriod40;
|
|
829
835
|
}
|
|
830
836
|
};
|
|
831
|
-
|
|
832
837
|
//#endregion
|
|
833
838
|
exports.NT4Client = NT4Client;
|
|
834
839
|
exports.NT4Subscription = NT4Subscription;
|
|
835
|
-
exports.NT4Topic = NT4Topic;
|
|
840
|
+
exports.NT4Topic = NT4Topic;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,69 +4,69 @@
|
|
|
4
4
|
*
|
|
5
5
|
* https://github.com/wpilibsuite/allwpilib/blob/main/ntcore/doc/networktables4.adoc#properties
|
|
6
6
|
*/
|
|
7
|
-
type TopicProperties = Record<string, unknown> & {
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export type TopicProperties = Record<string, unknown> & {
|
|
8
|
+
/**
|
|
9
|
+
* **Persistent flag**
|
|
10
|
+
*
|
|
11
|
+
* If `true`, the last set value will be periodically saved to persistent storage on the server
|
|
12
|
+
* and be restored during server startup. Topics with this property set to `true` will not
|
|
13
|
+
* be deleted by the server when the last publisher stops publishing.
|
|
14
|
+
*/
|
|
15
15
|
persistent?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
* **Retained flag**
|
|
18
|
+
*
|
|
19
|
+
* Topics with this property set to `true` will not be deleted by the server when
|
|
20
|
+
* the last publisher stops publishing.
|
|
21
|
+
*/
|
|
22
22
|
retained?: boolean;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
* **Cached flag**
|
|
25
|
+
*
|
|
26
|
+
* If `false`, the server and clients will not store the value of the topic.
|
|
27
|
+
* This means that only value updates will be available for the topic.
|
|
28
|
+
*/
|
|
29
29
|
cached?: boolean;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
32
|
* Subscription options, including well-known options
|
|
33
33
|
*/
|
|
34
|
-
type SubscriptionOptions = Record<string, unknown> & {
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
export type SubscriptionOptions = Record<string, unknown> & {
|
|
35
|
+
/**
|
|
36
|
+
* **Periodic sweep time (in seconds)**
|
|
37
|
+
*
|
|
38
|
+
* How frequently the server should send changes. The server may send more frequently than this
|
|
39
|
+
* (e.g. use a combined minimum period for all values) or apply a restricted range to this value
|
|
40
|
+
* The default if unspecified is 100 ms (same as NT 3.0).
|
|
41
|
+
*/
|
|
42
42
|
periodic?: number;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
* **All changes flag**
|
|
45
|
+
*
|
|
46
|
+
* If `true`, the server should send all value changes over the wire. If `false`, only
|
|
47
|
+
* the most recent value is sent (same as NT 3.0 behavior). If not specified, defaults to `false`.
|
|
48
|
+
*/
|
|
49
49
|
all?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
* **No value changes flag**
|
|
52
|
+
*
|
|
53
|
+
* If `true`, the server should not send any value changes over the wire regardless of other options.
|
|
54
|
+
* This is useful for only getting topic announcements. If `false`, value changes are sent in accordance
|
|
55
|
+
* with other options. If not specified, defaults to `false`.
|
|
56
|
+
*/
|
|
57
57
|
topicsonly?: boolean;
|
|
58
58
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
* **Prefix flag**
|
|
60
|
+
*
|
|
61
|
+
* If `true`, any topic starting with the name in the subscription topics list is subscribed to,
|
|
62
|
+
* not just exact matches. If not specified, defaults to `false`.
|
|
63
|
+
*/
|
|
64
64
|
prefix?: boolean;
|
|
65
65
|
};
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/NT4Subscription.d.ts
|
|
68
68
|
/** Contains information about NT4 subscription. */
|
|
69
|
-
declare class NT4Subscription {
|
|
69
|
+
export declare class NT4Subscription {
|
|
70
70
|
/** Subscription UID. */
|
|
71
71
|
readonly uid: number;
|
|
72
72
|
/** Subscription options. */
|
|
@@ -78,7 +78,7 @@ declare class NT4Subscription {
|
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/NT4Topic.d.ts
|
|
80
80
|
/** Contains information about NT4 topic. */
|
|
81
|
-
declare class NT4Topic {
|
|
81
|
+
export declare class NT4Topic {
|
|
82
82
|
/** Topic UID. */
|
|
83
83
|
readonly uid: number;
|
|
84
84
|
/** Topic name. */
|
|
@@ -134,64 +134,65 @@ declare const DataTypeCodes: {
|
|
|
134
134
|
type DataType = keyof typeof DataTypeCodes;
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/NT4Client.d.ts
|
|
137
|
-
type NT4ClientConnectionState = "disconnected" | "connecting" | "connected";
|
|
138
|
-
type NT4ClientOptions = {
|
|
139
|
-
/** Indicates that secure channel should be used. */
|
|
137
|
+
export type NT4ClientConnectionState = "disconnected" | "connecting" | "connected";
|
|
138
|
+
export type NT4ClientOptions = {
|
|
139
|
+
/** Indicates that secure channel should be used. */
|
|
140
|
+
secure?: boolean;
|
|
140
141
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
* Invoked when the client connects.
|
|
143
|
+
*/
|
|
143
144
|
onConnect?: () => void;
|
|
144
145
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
* Invoked when the client disconnects.
|
|
147
|
+
*/
|
|
147
148
|
onDisconnect?: () => void;
|
|
148
149
|
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
* Invoked when new topic is announced by the server.
|
|
151
|
+
*
|
|
152
|
+
* @param topic topic announced
|
|
153
|
+
*/
|
|
153
154
|
onTopicAnnounced?: (topic: NT4Topic) => void;
|
|
154
155
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
* Invoked when a topic is removed by the server.
|
|
157
|
+
*
|
|
158
|
+
* @param topic topic removed
|
|
159
|
+
*/
|
|
159
160
|
onTopicRemoved?: (topic: NT4Topic) => void;
|
|
160
161
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
* Invoked when a topic properties are updated by the server.
|
|
163
|
+
*
|
|
164
|
+
* @param topic topic updated
|
|
165
|
+
*/
|
|
165
166
|
onTopicUpdated?: (topic: NT4Topic) => void;
|
|
166
167
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
* Invoked when the topic receives new data.
|
|
169
|
+
*
|
|
170
|
+
* @param topic topic receiving data
|
|
171
|
+
* @param value value received
|
|
172
|
+
* @param timestamp server timestamp in microseconds
|
|
173
|
+
*/
|
|
173
174
|
onDataReceived?: (topic: NT4Topic, value: unknown, timestamp: number) => void;
|
|
174
175
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
* Retry policy that accepts the current number of connection attempts
|
|
177
|
+
* and returns the timeout in milliseconds or -1 to abort.
|
|
178
|
+
*
|
|
179
|
+
* @param attempts number of subsequent connection attempts
|
|
180
|
+
* @returns timeout in milliseconds or -1 to abort
|
|
181
|
+
*/
|
|
181
182
|
retryPolicy?: (attempts: number) => number;
|
|
182
183
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
* Overrides default timeout for ping-pong packets.
|
|
185
|
+
*
|
|
186
|
+
* Defaults:
|
|
187
|
+
* - NT 4.0: 3000 milliseconds
|
|
188
|
+
* - NT 4.1: 1000 milliseconds
|
|
189
|
+
*/
|
|
189
190
|
pingTimeoutMilliseconds?: number;
|
|
190
191
|
};
|
|
191
192
|
/**
|
|
192
193
|
* Implements a NetworkTable4 client that is responsible for establishing and maintaining a connection.
|
|
193
194
|
*/
|
|
194
|
-
declare class NT4Client {
|
|
195
|
+
export declare class NT4Client {
|
|
195
196
|
private readonly port;
|
|
196
197
|
private readonly clientId;
|
|
197
198
|
private readonly dataChannel;
|
|
@@ -251,14 +252,14 @@ declare class NT4Client {
|
|
|
251
252
|
/** Sends data frame to update topic value. */
|
|
252
253
|
private sendValueCore;
|
|
253
254
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
* Sends RTT measurement binary frame.
|
|
256
|
+
* Uses RTT channel if available, falls back to data channel in NT4.0.
|
|
257
|
+
*/
|
|
257
258
|
private sendRTT;
|
|
258
259
|
/**
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
* Determines whether connection times out if no message has been received
|
|
261
|
+
* within the timeout interval since the last pong.
|
|
262
|
+
*/
|
|
262
263
|
private checkTimeout;
|
|
263
264
|
/** Generates random UID. */
|
|
264
265
|
private generateUID;
|
|
@@ -269,160 +270,159 @@ declare class NT4Client {
|
|
|
269
270
|
/** Determines whether subscription with the specified identifier exists. */
|
|
270
271
|
private readonly hasSubscriptionWithId;
|
|
271
272
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
* Constructs an instance of NT4Client without initiating a connection.
|
|
274
|
+
*
|
|
275
|
+
* @param serverAddress NT4 server network address
|
|
276
|
+
* @param clientId this client identifier (cannot contain '@')
|
|
277
|
+
* @param options options
|
|
278
|
+
*/
|
|
278
279
|
constructor(serverAddress: string, clientId: string, options: NT4ClientOptions);
|
|
279
280
|
/**
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
* Returns NT4 server network address the client is using.
|
|
282
|
+
*/
|
|
282
283
|
readonly serverAddress: string;
|
|
283
284
|
/**
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
* Returns current connection state.
|
|
286
|
+
*/
|
|
286
287
|
get state(): NT4ClientConnectionState;
|
|
287
288
|
/**
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
* Returns current network latency in microseconds if known.
|
|
290
|
+
*/
|
|
290
291
|
get networkLatencyMicroseconds(): number | null;
|
|
291
292
|
/**
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
293
|
+
* Returns server time in microseconds that is current or
|
|
294
|
+
* based on the specified client (local) time.
|
|
295
|
+
*
|
|
296
|
+
* Returns `null` if the server time offset is not established.
|
|
297
|
+
*/
|
|
297
298
|
serverTimeMicroseconds(clientTimeMicroseconds?: number): number | null;
|
|
298
299
|
/**
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
300
|
+
* Initiates the connection.
|
|
301
|
+
* Once established the connection will be automatically kept alive by reconnecting.
|
|
302
|
+
*/
|
|
302
303
|
connect(): void;
|
|
303
304
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
* Terminates the connection.
|
|
306
|
+
* The client can be reconnected manually by calling {@link connect} again.
|
|
307
|
+
*/
|
|
307
308
|
disconnect(): void;
|
|
308
309
|
/**
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
310
|
+
* Creates a new subscription.
|
|
311
|
+
*
|
|
312
|
+
* The subscription can be created regardless of connectivity state.
|
|
313
|
+
* All client subscriptions are automatically restored once connection
|
|
314
|
+
* has been established. This is also true for reconnects following
|
|
315
|
+
* loss of connectivity or deliberate disconnects.
|
|
316
|
+
*
|
|
317
|
+
* Caller can {@link unsubscribe} by passing the return value of this call or
|
|
318
|
+
* invoke {@link unsubscribeAll} to remove all existing client subscriptions.
|
|
319
|
+
*
|
|
320
|
+
* @param topics topics or prefixes to include in the subscription
|
|
321
|
+
* @param options subscription options
|
|
322
|
+
* @returns A subscription instance
|
|
323
|
+
*/
|
|
323
324
|
subscribe(topics: Iterable<string>, options: SubscriptionOptions): NT4Subscription;
|
|
324
325
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
* Unsubscribes an existing subscription.
|
|
327
|
+
*
|
|
328
|
+
* @param arg subscription or subscription identifier
|
|
329
|
+
* @returns `true` if the subscription was successfully unsubscribed, `false` if the subscription was not found
|
|
330
|
+
*/
|
|
330
331
|
unsubscribe(arg: NT4Subscription | number): boolean;
|
|
331
332
|
/**
|
|
332
|
-
|
|
333
|
-
|
|
333
|
+
* Unsubscribes all existing subscriptions.
|
|
334
|
+
*/
|
|
334
335
|
unsubscribeAll(): void;
|
|
335
336
|
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
337
|
+
* Publishes a topic with the specified name and type.
|
|
338
|
+
*
|
|
339
|
+
* This method registers this client as a publisher for the topic.
|
|
340
|
+
* It should be called before {@link setValue} or {@link setValueAt}
|
|
341
|
+
* can be used.
|
|
342
|
+
*
|
|
343
|
+
* Publishing a topic on a disconnected client is allowed.
|
|
344
|
+
* Client will automatically register such publishers once the connection
|
|
345
|
+
* has been established and send default or retained value as appropriate.
|
|
346
|
+
*
|
|
347
|
+
* @param topic topic name
|
|
348
|
+
* @param type data type
|
|
349
|
+
* @param properties properties
|
|
350
|
+
*/
|
|
350
351
|
publishTopic(topic: string, type: DataType | string, properties?: TopicProperties): NT4Topic;
|
|
351
352
|
/**
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
353
|
+
* Un-publishes previously published topic.
|
|
354
|
+
*
|
|
355
|
+
* @param topic topic name
|
|
356
|
+
* @returns `true` if the topic was successfully unpublished, `false` if the topic was not published
|
|
357
|
+
*/
|
|
357
358
|
unpublishTopic(topic: string): boolean;
|
|
358
359
|
/**
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
* Determines whether client already publishes the topic.
|
|
361
|
+
*
|
|
362
|
+
* @param topic topic name
|
|
363
|
+
*/
|
|
363
364
|
isTopicPublished(topic: string): boolean;
|
|
364
365
|
/**
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
* Sets properties for the specified topic.
|
|
367
|
+
*
|
|
368
|
+
* @param topic topic name
|
|
369
|
+
* @param properties new properties
|
|
370
|
+
*/
|
|
370
371
|
setTopicProperties(topic: string, properties: TopicProperties): void;
|
|
371
372
|
/**
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
* Sets persistent flag for the topic.
|
|
374
|
+
*
|
|
375
|
+
* @param topic topic name
|
|
376
|
+
* @param value value to set
|
|
377
|
+
*/
|
|
377
378
|
setTopicPersistent(topic: string, value: boolean): void;
|
|
378
379
|
/**
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
* Sets retained flag for the topic.
|
|
381
|
+
*
|
|
382
|
+
* @param topic topic name
|
|
383
|
+
* @param value value to set
|
|
384
|
+
*/
|
|
384
385
|
setTopicRetained(topic: string, value: boolean): void;
|
|
385
386
|
/**
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
387
|
+
* Sends a value to the published topic using the current time.
|
|
388
|
+
*
|
|
389
|
+
* This client must publish the topic with {@link publishTopic} first.
|
|
390
|
+
*
|
|
391
|
+
* @param topic topic name
|
|
392
|
+
* @param value value to send
|
|
393
|
+
*/
|
|
393
394
|
setValue(topic: string, value: unknown): void;
|
|
394
395
|
/**
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
396
|
+
* Sends a default ("weak") value to the published topic.
|
|
397
|
+
*
|
|
398
|
+
* This client must publish the topic with {@link publishTopic} first.
|
|
399
|
+
*
|
|
400
|
+
* @param topic topic name
|
|
401
|
+
* @param value value to send
|
|
402
|
+
*/
|
|
402
403
|
setDefaultValue(topic: string, value: unknown): void;
|
|
403
404
|
/**
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
405
|
+
* Sends a value to the published topic using the specified timestamp.
|
|
406
|
+
*
|
|
407
|
+
* This client must publish the topic with {@link publishTopic} first.
|
|
408
|
+
*
|
|
409
|
+
* @param topic topic name
|
|
410
|
+
* @param value value to send
|
|
411
|
+
* @param timestamp timestamp
|
|
412
|
+
*/
|
|
412
413
|
setValueAt(topic: string, value: unknown, timestamp: number): void;
|
|
413
414
|
/**
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
415
|
+
* Returns current ping timeout.
|
|
416
|
+
*
|
|
417
|
+
* @returns A value in milliseconds or 0 if the timeout has not been set yet.
|
|
418
|
+
*/
|
|
418
419
|
get pingTimeoutMilliseconds(): number;
|
|
419
420
|
/**
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
* Sets ping timeout.
|
|
422
|
+
*
|
|
423
|
+
* @param value Timeout in milliseconds or `undefined` to use default protocol timeout value.
|
|
424
|
+
*/
|
|
424
425
|
setPingTimeoutMilliseconds(value: number | undefined): void;
|
|
425
426
|
}
|
|
426
427
|
//#endregion
|
|
427
|
-
export { NT4Client, NT4ClientConnectionState, NT4ClientOptions, NT4Subscription, NT4Topic, SubscriptionOptions, TopicProperties };
|
|
428
428
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/NT4Types.ts","../src/NT4Subscription.ts","../src/NT4Topic.ts","../src/NT4Spec.ts","../src/NT4Client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/NT4Types.ts","../src/NT4Subscription.ts","../src/NT4Topic.ts","../src/NT4Spec.ts","../src/NT4Client.ts"],"mappings":";;;;;;YAKY,kBAAkB;;;;;;;;EAQ5B;;;;;;;EAQA;;;;;;;EAQA;;;;;YAMU,sBAAsB;;;;;;;;EAQhC;;;;;;;EAQA;;;;;;;;EASA;;;;;;;EAQA;;;;;qBCjEW;;WAEK;;WAGA,SAAS;;WAGT,QAAQ;EAEZ,YAAA,aAAa,QAAQ,kBAAkB,UAAU;;;;;qBCPlD;;WAEK;;WAGA;;WAGA;;WAGA,YAAY;;EAGrB;;EAGA;;EAGA;EAEK,YAAA,aAAa,cAAc,cAAc,aAAa,iBAAiB;;EAU5E,gBAAgB,YAAY;;EAW5B,oBAAoB,gBAAgB;;EAQpC;;EAQA;;EAOA,UAAU;;WAiCD;;;;;;;;;cClEL;;;;;;;;;;;;;;;;;KAkBD,wBAAwB;;;YC7CxB;YAEA;;EAEV;;;;EAKA;;;;EAKA;;;;;;EAOA,oBAAoB,OAAO;;;;;;EAO3B,kBAAkB,OAAO;;;;;;EAOzB,kBAAkB,OAAO;;;;;;;;EASzB,kBAAkB,OAAO,UAAU,gBAAgB;;;;;;;;EASnD,eAAe;;;;;;;;EASf;;;;;qBAgBW;mBACM;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;mBACA;UACT;UAEA;UACA;UACA;UACA;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;SAGM,mBAAmB;;UAKzB;;UAmCM;;UAgHN;;UAeA;;UA+IA;;UAKA;;UAUA;;UAQA;;UAMA;;UAaA;;UAUA;;UAWA;;UAYA;;UAUA;;;;;UASA;;;;;UAgBM;;UAkBN;;UAKA;;mBAOS;;mBAGA;;;;;;;;EASL,YAAA,uBAAuB,kBAAkB,SAAS;;;;WA0C9C;;;;MAKL,SAAK;;;;MAOL;;;;;;;EAUJ,uBAAuB;;;;;EAavB;;;;;EAcA;;;;;;;;;;;;;;;;EA0BA,UAAU,QAAQ,kBAAkB,SAAS,sBAAmB;;;;;;;EAkBhE,YAAY,KAAK;;;;EAiBjB;;;;;;;;;;;;;;;;EAqBA,aAAa,eAAe,MAAM,mBAAmB,aAAa,kBAAe;;;;;;;EAuBjF,eAAe;;;;;;EAmBf,iBAAiB;;;;;;;EAUjB,mBAAmB,eAAe,YAAY;;;;;;;EAsB9C,mBAAmB,eAAe;;;;;;;EAUlC,iBAAiB,eAAe;;;;;;;;;EAYhC,SAAS,eAAe;;;;;;;;;EAYxB,gBAAgB,eAAe;;;;;;;;;;EAa/B,WAAW,eAAe,gBAAgB;;;;;;MAiCtC;;;;;;EASJ,2BAA2B"}
|