@vertexvis/stream-api 0.24.5 → 1.0.0-canary.0
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/bundle.cjs +1095 -0
- package/dist/bundle.cjs.map +1 -0
- package/dist/bundle.js +1080 -0
- package/dist/bundle.js.map +1 -0
- package/dist/connection.d.ts +4 -4
- package/dist/encoder.d.ts +3 -3
- package/dist/errors.d.ts +8 -8
- package/dist/index.d.ts +13 -12
- package/dist/paramsBuilder.d.ts +5 -5
- package/dist/settings.d.ts +106 -106
- package/dist/streamApi.d.ts +327 -327
- package/dist/testing/__tests__/webSocketClientMock.spec.d.ts +1 -1
- package/dist/testing/fixtures/events.d.ts +2 -2
- package/dist/testing/fixtures/index.d.ts +4 -4
- package/dist/testing/fixtures/requests.d.ts +14 -14
- package/dist/testing/fixtures/responses.d.ts +20 -20
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/webSocketClientMock.d.ts +77 -77
- package/dist/time.d.ts +37 -37
- package/dist/types.d.ts +63 -63
- package/dist/validators.d.ts +9 -9
- package/dist/webSocketClient.d.ts +28 -28
- package/package.json +25 -15
- package/dist/bundle.cjs.js +0 -50061
- package/dist/bundle.cjs.js.map +0 -1
- package/dist/bundle.esm.js +0 -50047
- package/dist/bundle.esm.js.map +0 -1
package/dist/streamApi.d.ts
CHANGED
|
@@ -1,327 +1,327 @@
|
|
|
1
|
-
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
-
import { Disposable } from '@vertexvis/utils';
|
|
3
|
-
import { ConnectionDescriptor } from './connection';
|
|
4
|
-
import { Settings } from './settings';
|
|
5
|
-
import { BeginInteractionPayload, EndInteractionPayload, EventMessage, GetStencilBufferPayload, HitItemsPayload, LoadSceneViewStatePayload, ReconnectPayload, RecordPerformancePayload, ReplaceCameraPayload, RequestMessage, ResponseError, ResponseMessage, ResponseResult, StartStreamPayload, SyncTimePayload, UpdateCrossSectioningPayload, UpdateDimensionsPayload, UpdateInteractionPayload, UpdateModelViewPayload, UpdateStreamPayload } from './types';
|
|
6
|
-
import { WebSocketClient } from './webSocketClient';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export interface StreamApiOptions {
|
|
12
|
-
loggingEnabled?: boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The API client to interact with Vertex's streaming API.
|
|
16
|
-
*/
|
|
17
|
-
export declare class StreamApi {
|
|
18
|
-
private websocket;
|
|
19
|
-
private onResponseDispatcher;
|
|
20
|
-
private onRequestDispatcher;
|
|
21
|
-
private onEventDispatcher;
|
|
22
|
-
private messageSubscription?;
|
|
23
|
-
private opts;
|
|
24
|
-
constructor(websocket?: WebSocketClient, opts?: StreamApiOptions);
|
|
25
|
-
/**
|
|
26
|
-
* Initiates a websocket connection to Vertex's streaming API. Returns a
|
|
27
|
-
* promise that resolves once the connection is established and can begin
|
|
28
|
-
* accepting messages.
|
|
29
|
-
*
|
|
30
|
-
* @param descriptor A function that returns a description of how to establish
|
|
31
|
-
* a WS connection.
|
|
32
|
-
* @param settings A configuration to use when initializing the WS connection.
|
|
33
|
-
*/
|
|
34
|
-
connect(descriptor: ConnectionDescriptor, settings?: Settings): Promise<Disposable>;
|
|
35
|
-
/**
|
|
36
|
-
* Closes any open WS connections and disposes of resources.
|
|
37
|
-
*/
|
|
38
|
-
dispose(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Adds a callback that is invoked when the client receives a request from the
|
|
41
|
-
* server. Returns a `Disposable` that can be used to remove the listener.
|
|
42
|
-
*
|
|
43
|
-
* @param handler A handler function.
|
|
44
|
-
*/
|
|
45
|
-
onRequest(handler: RequestMessageHandler): Disposable;
|
|
46
|
-
/**
|
|
47
|
-
* Adds a callback that is invoked when the client receives an event from the
|
|
48
|
-
* server. Returns a `Disposable` that can be used to remove the listener.
|
|
49
|
-
*
|
|
50
|
-
* @param handler - A handler function.
|
|
51
|
-
*/
|
|
52
|
-
onEvent(handler: EventMessageHandler): Disposable;
|
|
53
|
-
/**
|
|
54
|
-
* Adds a callback that is invoked when the websocket connection is closed.
|
|
55
|
-
*
|
|
56
|
-
* @param handler A handler function.
|
|
57
|
-
*/
|
|
58
|
-
onClose(handler: CloseEventHandler): Disposable;
|
|
59
|
-
/**
|
|
60
|
-
* Sends a request to initiate a streaming session.
|
|
61
|
-
*
|
|
62
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
63
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
64
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
65
|
-
* the frame.
|
|
66
|
-
*
|
|
67
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
68
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
69
|
-
* it'll complete when a response is received.
|
|
70
|
-
*
|
|
71
|
-
* @param payload The payload of the request.
|
|
72
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
73
|
-
* Defaults to `true`.
|
|
74
|
-
*/
|
|
75
|
-
startStream(payload: StartStreamPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
76
|
-
/**
|
|
77
|
-
* Sends a request to reconnect to an existing streaming session.
|
|
78
|
-
*
|
|
79
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
80
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
81
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
82
|
-
* the frame.
|
|
83
|
-
*
|
|
84
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
85
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
86
|
-
* it'll complete when a response is received.
|
|
87
|
-
*
|
|
88
|
-
* @param payload The payload of the request.
|
|
89
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
90
|
-
* Defaults to `true`.
|
|
91
|
-
*/
|
|
92
|
-
reconnect(payload: ReconnectPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
93
|
-
updateStream(payload: UpdateStreamPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IUpdateStreamResult>;
|
|
94
|
-
/**
|
|
95
|
-
* Sends a request to signal to the rendering pipeline that an interaction has
|
|
96
|
-
* started. The rendering pipeline will use this as a hint to perform more
|
|
97
|
-
* aggressive rendering optimizations at the expense of rendering quality.
|
|
98
|
-
* Call `endInteraction` to signal to the rendering pipeline that an
|
|
99
|
-
* interaction has finished.
|
|
100
|
-
*
|
|
101
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
102
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
103
|
-
* it'll complete when a response is received.
|
|
104
|
-
*
|
|
105
|
-
* @param data The payload of the request.
|
|
106
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
107
|
-
* Defaults to `true`.
|
|
108
|
-
*/
|
|
109
|
-
beginInteraction(payload?: BeginInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
110
|
-
/**
|
|
111
|
-
* Sends a request to update the position of the scene's camera.
|
|
112
|
-
*
|
|
113
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
114
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
115
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
116
|
-
* the frame.
|
|
117
|
-
*
|
|
118
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
119
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
120
|
-
* it'll complete when a response is received.
|
|
121
|
-
*
|
|
122
|
-
* @param payload The payload of the request.
|
|
123
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
124
|
-
* Defaults to `true`.
|
|
125
|
-
*/
|
|
126
|
-
replaceCamera(payload: ReplaceCameraPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
127
|
-
/**
|
|
128
|
-
* Sends a request to update the position of the scene's camera as a fly operation
|
|
129
|
-
*
|
|
130
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
131
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
132
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
133
|
-
* the frame.
|
|
134
|
-
*
|
|
135
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
136
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
137
|
-
* it'll complete when a response is received.
|
|
138
|
-
*
|
|
139
|
-
* @param payload
|
|
140
|
-
* @param withResponse
|
|
141
|
-
*/
|
|
142
|
-
flyTo(payload: vertexvis.protobuf.stream.IFlyToPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
143
|
-
/**
|
|
144
|
-
* Sends a request to update the specified interaction.
|
|
145
|
-
*
|
|
146
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
147
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
148
|
-
* it'll complete when a response is received.
|
|
149
|
-
*
|
|
150
|
-
* @param payload The payload of the request.
|
|
151
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
152
|
-
* Defaults to `true`.
|
|
153
|
-
*/
|
|
154
|
-
updateInteraction(payload: UpdateInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
155
|
-
/**
|
|
156
|
-
* Sends a request to update the dimensions of the frame.
|
|
157
|
-
*
|
|
158
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
159
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
160
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
161
|
-
* the frame.
|
|
162
|
-
*
|
|
163
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
164
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
165
|
-
* it'll complete when a response is received.
|
|
166
|
-
*
|
|
167
|
-
* @param payload The payload of the request.
|
|
168
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
169
|
-
* Defaults to `true`.
|
|
170
|
-
*/
|
|
171
|
-
updateDimensions(payload: UpdateDimensionsPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
172
|
-
/**
|
|
173
|
-
* Sends a request to update the cross sectioning planes of the frame.
|
|
174
|
-
*
|
|
175
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
176
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
177
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
178
|
-
* the frame.
|
|
179
|
-
*
|
|
180
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
181
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
182
|
-
* it'll complete when a response is received.
|
|
183
|
-
*
|
|
184
|
-
* @param payload The payload of the request.
|
|
185
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
186
|
-
* Defaults to `true`.
|
|
187
|
-
*/
|
|
188
|
-
updateCrossSectioning(payload: UpdateCrossSectioningPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
189
|
-
/**
|
|
190
|
-
* Sends a request to set or clear the model view of the frame.
|
|
191
|
-
*
|
|
192
|
-
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
193
|
-
* back on the frame that is associated to this request. Use `onRequest` to
|
|
194
|
-
* add a callback that'll be invoked when the server sends a request to draw
|
|
195
|
-
* the frame.
|
|
196
|
-
*
|
|
197
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
198
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
199
|
-
* it'll complete when a response is received.
|
|
200
|
-
*
|
|
201
|
-
* @param payload The payload of the request.
|
|
202
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
203
|
-
* Defaults to `true`.
|
|
204
|
-
*/
|
|
205
|
-
updateModelView(payload: UpdateModelViewPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
206
|
-
/**
|
|
207
|
-
* Sends a request to perform hit detection.
|
|
208
|
-
*
|
|
209
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
210
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
211
|
-
* it'll complete when a response is received.
|
|
212
|
-
*
|
|
213
|
-
* @param payload The payload of the request.
|
|
214
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
215
|
-
* Defaults to `true`.
|
|
216
|
-
*/
|
|
217
|
-
hitItems(payload: HitItemsPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
218
|
-
/**
|
|
219
|
-
* Sends a request to perform an alteration to a scene. Alterations include
|
|
220
|
-
* changing item visibility and changing the materials of items.
|
|
221
|
-
*
|
|
222
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
223
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
224
|
-
* it'll complete when a response is received.
|
|
225
|
-
*
|
|
226
|
-
* @param payload The payload of the request.
|
|
227
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
228
|
-
* Defaults to `true`.
|
|
229
|
-
*/
|
|
230
|
-
createSceneAlteration(payload: vertexvis.protobuf.stream.ICreateSceneAlterationPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
231
|
-
/**
|
|
232
|
-
* Sends a request to reset all overrides for a given scene and optionally to
|
|
233
|
-
* reset the camera to that of the base scene.
|
|
234
|
-
*
|
|
235
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
236
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
237
|
-
* it'll complete when a response is received.
|
|
238
|
-
*
|
|
239
|
-
* @param payload The payload of the request.
|
|
240
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
241
|
-
* Defaults to `true`.
|
|
242
|
-
*/
|
|
243
|
-
resetSceneView(payload: vertexvis.protobuf.stream.IResetViewPlayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
244
|
-
/**
|
|
245
|
-
* Sends a request to tell the rendering pipeline that an interaction has
|
|
246
|
-
* ended.
|
|
247
|
-
*
|
|
248
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
249
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
250
|
-
* it'll complete when a response is received.
|
|
251
|
-
*
|
|
252
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
253
|
-
* Defaults to `true`.
|
|
254
|
-
*/
|
|
255
|
-
endInteraction(payload?: EndInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IBeginInteractionResult>;
|
|
256
|
-
/**
|
|
257
|
-
* Sends a request to sync the clocks between the client and server.
|
|
258
|
-
*
|
|
259
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
260
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
261
|
-
* it'll complete when a response is received.
|
|
262
|
-
*
|
|
263
|
-
* @param payload The request payload.
|
|
264
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
265
|
-
* Defaults to `true`.
|
|
266
|
-
*/
|
|
267
|
-
syncTime(payload: SyncTimePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
268
|
-
/**
|
|
269
|
-
* Sends a request to record performance timings that were measured in the
|
|
270
|
-
* client. The server may use these timings as hints to optimize the rendering
|
|
271
|
-
* performance to provide a better experience.
|
|
272
|
-
*
|
|
273
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
274
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
275
|
-
* it'll complete when a response is received.
|
|
276
|
-
*
|
|
277
|
-
* @param payload The request payload
|
|
278
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
279
|
-
* Defaults to `true`.
|
|
280
|
-
*/
|
|
281
|
-
recordPerformance(payload: RecordPerformancePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
282
|
-
/**
|
|
283
|
-
* Sends a request to update the current scene view with the state present
|
|
284
|
-
* in the specified scene view state.
|
|
285
|
-
*
|
|
286
|
-
* Use `withResponse` to indicate if the server should reply with a response.
|
|
287
|
-
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
288
|
-
* it'll complete when a response is received.
|
|
289
|
-
*
|
|
290
|
-
* @param payload
|
|
291
|
-
* @param withResponse
|
|
292
|
-
*/
|
|
293
|
-
loadSceneViewState(payload: LoadSceneViewStatePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
294
|
-
/**
|
|
295
|
-
* Sends a request to get a stencil buffer image for the current scene view.
|
|
296
|
-
*/
|
|
297
|
-
getStencilBuffer(payload: GetStencilBufferPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
298
|
-
/**
|
|
299
|
-
* Sends a request to retrieve a new token. This token can be used to
|
|
300
|
-
* authenticate with other Vertex services.
|
|
301
|
-
*
|
|
302
|
-
* @param withResponse Indicates if the server should reply with a response.
|
|
303
|
-
* @returns A promise that completes with the refreshed token.
|
|
304
|
-
*/
|
|
305
|
-
refreshToken(withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
306
|
-
/**
|
|
307
|
-
* Acknowledges a successful request by sending a reply back to the server
|
|
308
|
-
* with an optional result body.
|
|
309
|
-
*
|
|
310
|
-
* @param reqId The ID of the received request.
|
|
311
|
-
* @param result A result to reply with.
|
|
312
|
-
*/
|
|
313
|
-
replyResult(reqId: string, result: ResponseResult): void;
|
|
314
|
-
/**
|
|
315
|
-
* Acknowledges a failed request by sending a reply back to the server.
|
|
316
|
-
*
|
|
317
|
-
* @param reqId The ID of the received request.
|
|
318
|
-
* @param error An error to reply with.
|
|
319
|
-
*/
|
|
320
|
-
replyError(reqId: string, error: ResponseError): void;
|
|
321
|
-
protected handleMessage(message: MessageEvent): void;
|
|
322
|
-
protected onResponse(handler: ResponseMessageHandler): Disposable;
|
|
323
|
-
protected log(msg: string, ...other: unknown[]): void;
|
|
324
|
-
private sendRequest;
|
|
325
|
-
private sendMessage;
|
|
326
|
-
private sendResponse;
|
|
327
|
-
}
|
|
1
|
+
import { vertexvis } from '@vertexvis/frame-streaming-protos';
|
|
2
|
+
import { Disposable } from '@vertexvis/utils';
|
|
3
|
+
import { ConnectionDescriptor } from './connection';
|
|
4
|
+
import { Settings } from './settings';
|
|
5
|
+
import { BeginInteractionPayload, EndInteractionPayload, EventMessage, GetStencilBufferPayload, HitItemsPayload, LoadSceneViewStatePayload, ReconnectPayload, RecordPerformancePayload, ReplaceCameraPayload, RequestMessage, ResponseError, ResponseMessage, ResponseResult, StartStreamPayload, SyncTimePayload, UpdateCrossSectioningPayload, UpdateDimensionsPayload, UpdateInteractionPayload, UpdateModelViewPayload, UpdateStreamPayload } from './types';
|
|
6
|
+
import { WebSocketClient } from './webSocketClient';
|
|
7
|
+
export type RequestMessageHandler = (msg: RequestMessage) => void;
|
|
8
|
+
export type ResponseMessageHandler = (msg: ResponseMessage) => void;
|
|
9
|
+
export type EventMessageHandler = (msg: EventMessage) => void;
|
|
10
|
+
export type CloseEventHandler = (evt: CloseEvent) => void;
|
|
11
|
+
export interface StreamApiOptions {
|
|
12
|
+
loggingEnabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The API client to interact with Vertex's streaming API.
|
|
16
|
+
*/
|
|
17
|
+
export declare class StreamApi {
|
|
18
|
+
private websocket;
|
|
19
|
+
private onResponseDispatcher;
|
|
20
|
+
private onRequestDispatcher;
|
|
21
|
+
private onEventDispatcher;
|
|
22
|
+
private messageSubscription?;
|
|
23
|
+
private opts;
|
|
24
|
+
constructor(websocket?: WebSocketClient, opts?: StreamApiOptions);
|
|
25
|
+
/**
|
|
26
|
+
* Initiates a websocket connection to Vertex's streaming API. Returns a
|
|
27
|
+
* promise that resolves once the connection is established and can begin
|
|
28
|
+
* accepting messages.
|
|
29
|
+
*
|
|
30
|
+
* @param descriptor A function that returns a description of how to establish
|
|
31
|
+
* a WS connection.
|
|
32
|
+
* @param settings A configuration to use when initializing the WS connection.
|
|
33
|
+
*/
|
|
34
|
+
connect(descriptor: ConnectionDescriptor, settings?: Settings): Promise<Disposable>;
|
|
35
|
+
/**
|
|
36
|
+
* Closes any open WS connections and disposes of resources.
|
|
37
|
+
*/
|
|
38
|
+
dispose(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a callback that is invoked when the client receives a request from the
|
|
41
|
+
* server. Returns a `Disposable` that can be used to remove the listener.
|
|
42
|
+
*
|
|
43
|
+
* @param handler A handler function.
|
|
44
|
+
*/
|
|
45
|
+
onRequest(handler: RequestMessageHandler): Disposable;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a callback that is invoked when the client receives an event from the
|
|
48
|
+
* server. Returns a `Disposable` that can be used to remove the listener.
|
|
49
|
+
*
|
|
50
|
+
* @param handler - A handler function.
|
|
51
|
+
*/
|
|
52
|
+
onEvent(handler: EventMessageHandler): Disposable;
|
|
53
|
+
/**
|
|
54
|
+
* Adds a callback that is invoked when the websocket connection is closed.
|
|
55
|
+
*
|
|
56
|
+
* @param handler A handler function.
|
|
57
|
+
*/
|
|
58
|
+
onClose(handler: CloseEventHandler): Disposable;
|
|
59
|
+
/**
|
|
60
|
+
* Sends a request to initiate a streaming session.
|
|
61
|
+
*
|
|
62
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
63
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
64
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
65
|
+
* the frame.
|
|
66
|
+
*
|
|
67
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
68
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
69
|
+
* it'll complete when a response is received.
|
|
70
|
+
*
|
|
71
|
+
* @param payload The payload of the request.
|
|
72
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
73
|
+
* Defaults to `true`.
|
|
74
|
+
*/
|
|
75
|
+
startStream(payload: StartStreamPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Sends a request to reconnect to an existing streaming session.
|
|
78
|
+
*
|
|
79
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
80
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
81
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
82
|
+
* the frame.
|
|
83
|
+
*
|
|
84
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
85
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
86
|
+
* it'll complete when a response is received.
|
|
87
|
+
*
|
|
88
|
+
* @param payload The payload of the request.
|
|
89
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
90
|
+
* Defaults to `true`.
|
|
91
|
+
*/
|
|
92
|
+
reconnect(payload: ReconnectPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
93
|
+
updateStream(payload: UpdateStreamPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IUpdateStreamResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Sends a request to signal to the rendering pipeline that an interaction has
|
|
96
|
+
* started. The rendering pipeline will use this as a hint to perform more
|
|
97
|
+
* aggressive rendering optimizations at the expense of rendering quality.
|
|
98
|
+
* Call `endInteraction` to signal to the rendering pipeline that an
|
|
99
|
+
* interaction has finished.
|
|
100
|
+
*
|
|
101
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
102
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
103
|
+
* it'll complete when a response is received.
|
|
104
|
+
*
|
|
105
|
+
* @param data The payload of the request.
|
|
106
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
107
|
+
* Defaults to `true`.
|
|
108
|
+
*/
|
|
109
|
+
beginInteraction(payload?: BeginInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Sends a request to update the position of the scene's camera.
|
|
112
|
+
*
|
|
113
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
114
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
115
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
116
|
+
* the frame.
|
|
117
|
+
*
|
|
118
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
119
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
120
|
+
* it'll complete when a response is received.
|
|
121
|
+
*
|
|
122
|
+
* @param payload The payload of the request.
|
|
123
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
124
|
+
* Defaults to `true`.
|
|
125
|
+
*/
|
|
126
|
+
replaceCamera(payload: ReplaceCameraPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
127
|
+
/**
|
|
128
|
+
* Sends a request to update the position of the scene's camera as a fly operation
|
|
129
|
+
*
|
|
130
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
131
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
132
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
133
|
+
* the frame.
|
|
134
|
+
*
|
|
135
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
136
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
137
|
+
* it'll complete when a response is received.
|
|
138
|
+
*
|
|
139
|
+
* @param payload
|
|
140
|
+
* @param withResponse
|
|
141
|
+
*/
|
|
142
|
+
flyTo(payload: vertexvis.protobuf.stream.IFlyToPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
143
|
+
/**
|
|
144
|
+
* Sends a request to update the specified interaction.
|
|
145
|
+
*
|
|
146
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
147
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
148
|
+
* it'll complete when a response is received.
|
|
149
|
+
*
|
|
150
|
+
* @param payload The payload of the request.
|
|
151
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
152
|
+
* Defaults to `true`.
|
|
153
|
+
*/
|
|
154
|
+
updateInteraction(payload: UpdateInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Sends a request to update the dimensions of the frame.
|
|
157
|
+
*
|
|
158
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
159
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
160
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
161
|
+
* the frame.
|
|
162
|
+
*
|
|
163
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
164
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
165
|
+
* it'll complete when a response is received.
|
|
166
|
+
*
|
|
167
|
+
* @param payload The payload of the request.
|
|
168
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
169
|
+
* Defaults to `true`.
|
|
170
|
+
*/
|
|
171
|
+
updateDimensions(payload: UpdateDimensionsPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
172
|
+
/**
|
|
173
|
+
* Sends a request to update the cross sectioning planes of the frame.
|
|
174
|
+
*
|
|
175
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
176
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
177
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
178
|
+
* the frame.
|
|
179
|
+
*
|
|
180
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
181
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
182
|
+
* it'll complete when a response is received.
|
|
183
|
+
*
|
|
184
|
+
* @param payload The payload of the request.
|
|
185
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
186
|
+
* Defaults to `true`.
|
|
187
|
+
*/
|
|
188
|
+
updateCrossSectioning(payload: UpdateCrossSectioningPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
189
|
+
/**
|
|
190
|
+
* Sends a request to set or clear the model view of the frame.
|
|
191
|
+
*
|
|
192
|
+
* The payload accepts an optional `frameCorrelationId` that will be sent
|
|
193
|
+
* back on the frame that is associated to this request. Use `onRequest` to
|
|
194
|
+
* add a callback that'll be invoked when the server sends a request to draw
|
|
195
|
+
* the frame.
|
|
196
|
+
*
|
|
197
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
198
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
199
|
+
* it'll complete when a response is received.
|
|
200
|
+
*
|
|
201
|
+
* @param payload The payload of the request.
|
|
202
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
203
|
+
* Defaults to `true`.
|
|
204
|
+
*/
|
|
205
|
+
updateModelView(payload: UpdateModelViewPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Sends a request to perform hit detection.
|
|
208
|
+
*
|
|
209
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
210
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
211
|
+
* it'll complete when a response is received.
|
|
212
|
+
*
|
|
213
|
+
* @param payload The payload of the request.
|
|
214
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
215
|
+
* Defaults to `true`.
|
|
216
|
+
*/
|
|
217
|
+
hitItems(payload: HitItemsPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
218
|
+
/**
|
|
219
|
+
* Sends a request to perform an alteration to a scene. Alterations include
|
|
220
|
+
* changing item visibility and changing the materials of items.
|
|
221
|
+
*
|
|
222
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
223
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
224
|
+
* it'll complete when a response is received.
|
|
225
|
+
*
|
|
226
|
+
* @param payload The payload of the request.
|
|
227
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
228
|
+
* Defaults to `true`.
|
|
229
|
+
*/
|
|
230
|
+
createSceneAlteration(payload: vertexvis.protobuf.stream.ICreateSceneAlterationPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
231
|
+
/**
|
|
232
|
+
* Sends a request to reset all overrides for a given scene and optionally to
|
|
233
|
+
* reset the camera to that of the base scene.
|
|
234
|
+
*
|
|
235
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
236
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
237
|
+
* it'll complete when a response is received.
|
|
238
|
+
*
|
|
239
|
+
* @param payload The payload of the request.
|
|
240
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
241
|
+
* Defaults to `true`.
|
|
242
|
+
*/
|
|
243
|
+
resetSceneView(payload: vertexvis.protobuf.stream.IResetViewPlayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
244
|
+
/**
|
|
245
|
+
* Sends a request to tell the rendering pipeline that an interaction has
|
|
246
|
+
* ended.
|
|
247
|
+
*
|
|
248
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
249
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
250
|
+
* it'll complete when a response is received.
|
|
251
|
+
*
|
|
252
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
253
|
+
* Defaults to `true`.
|
|
254
|
+
*/
|
|
255
|
+
endInteraction(payload?: EndInteractionPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IBeginInteractionResult>;
|
|
256
|
+
/**
|
|
257
|
+
* Sends a request to sync the clocks between the client and server.
|
|
258
|
+
*
|
|
259
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
260
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
261
|
+
* it'll complete when a response is received.
|
|
262
|
+
*
|
|
263
|
+
* @param payload The request payload.
|
|
264
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
265
|
+
* Defaults to `true`.
|
|
266
|
+
*/
|
|
267
|
+
syncTime(payload: SyncTimePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
268
|
+
/**
|
|
269
|
+
* Sends a request to record performance timings that were measured in the
|
|
270
|
+
* client. The server may use these timings as hints to optimize the rendering
|
|
271
|
+
* performance to provide a better experience.
|
|
272
|
+
*
|
|
273
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
274
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
275
|
+
* it'll complete when a response is received.
|
|
276
|
+
*
|
|
277
|
+
* @param payload The request payload
|
|
278
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
279
|
+
* Defaults to `true`.
|
|
280
|
+
*/
|
|
281
|
+
recordPerformance(payload: RecordPerformancePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
282
|
+
/**
|
|
283
|
+
* Sends a request to update the current scene view with the state present
|
|
284
|
+
* in the specified scene view state.
|
|
285
|
+
*
|
|
286
|
+
* Use `withResponse` to indicate if the server should reply with a response.
|
|
287
|
+
* If `false`, the returned promise will complete immediately. Otherwise,
|
|
288
|
+
* it'll complete when a response is received.
|
|
289
|
+
*
|
|
290
|
+
* @param payload
|
|
291
|
+
* @param withResponse
|
|
292
|
+
*/
|
|
293
|
+
loadSceneViewState(payload: LoadSceneViewStatePayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
294
|
+
/**
|
|
295
|
+
* Sends a request to get a stencil buffer image for the current scene view.
|
|
296
|
+
*/
|
|
297
|
+
getStencilBuffer(payload: GetStencilBufferPayload, withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
298
|
+
/**
|
|
299
|
+
* Sends a request to retrieve a new token. This token can be used to
|
|
300
|
+
* authenticate with other Vertex services.
|
|
301
|
+
*
|
|
302
|
+
* @param withResponse Indicates if the server should reply with a response.
|
|
303
|
+
* @returns A promise that completes with the refreshed token.
|
|
304
|
+
*/
|
|
305
|
+
refreshToken(withResponse?: boolean): Promise<vertexvis.protobuf.stream.IStreamResponse>;
|
|
306
|
+
/**
|
|
307
|
+
* Acknowledges a successful request by sending a reply back to the server
|
|
308
|
+
* with an optional result body.
|
|
309
|
+
*
|
|
310
|
+
* @param reqId The ID of the received request.
|
|
311
|
+
* @param result A result to reply with.
|
|
312
|
+
*/
|
|
313
|
+
replyResult(reqId: string, result: ResponseResult): void;
|
|
314
|
+
/**
|
|
315
|
+
* Acknowledges a failed request by sending a reply back to the server.
|
|
316
|
+
*
|
|
317
|
+
* @param reqId The ID of the received request.
|
|
318
|
+
* @param error An error to reply with.
|
|
319
|
+
*/
|
|
320
|
+
replyError(reqId: string, error: ResponseError): void;
|
|
321
|
+
protected handleMessage(message: MessageEvent): void;
|
|
322
|
+
protected onResponse(handler: ResponseMessageHandler): Disposable;
|
|
323
|
+
protected log(msg: string, ...other: unknown[]): void;
|
|
324
|
+
private sendRequest;
|
|
325
|
+
private sendMessage;
|
|
326
|
+
private sendResponse;
|
|
327
|
+
}
|