mobility-toolbox-js 3.0.0-beta.9 → 3.0.1-beta.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/api/HttpAPI.d.ts +5 -16
- package/api/HttpAPI.js +0 -11
- package/api/RealtimeAPI.d.ts +221 -176
- package/api/RealtimeAPI.js +317 -258
- package/api/RoutingAPI.d.ts +21 -11
- package/api/RoutingAPI.js +17 -7
- package/api/StopsAPI.d.ts +20 -14
- package/api/StopsAPI.js +17 -11
- package/api/WebSocketAPI.d.ts +60 -66
- package/api/WebSocketAPI.js +164 -164
- package/api/index.js +1 -1
- package/api/typedefs.d.ts +0 -102
- package/api/typedefs.js +27 -42
- package/common/controls/StopFinderControlCommon.d.ts +12 -12
- package/common/controls/StopFinderControlCommon.js +31 -31
- package/common/index.d.ts +1 -1
- package/common/index.js +1 -1
- package/common/mixins/RealtimeLayerMixin.d.ts +157 -163
- package/common/mixins/RealtimeLayerMixin.js +401 -393
- package/common/styles/realtimeDefaultStyle.js +6 -6
- package/common/styles/realtimeHeadingStyle.js +5 -5
- package/common/typedefs.d.ts +13 -6
- package/common/typedefs.js +7 -1
- package/common/utils/compareDepartures.d.ts +2 -2
- package/common/utils/compareDepartures.js +2 -2
- package/common/utils/debounceWebsocketMessages.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.d.ts +1 -1
- package/common/utils/getMapGlCopyrights.js +3 -3
- package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
- package/common/utils/getRealtimeModeSuffix.js +1 -0
- package/common/utils/getVehiclePosition.d.ts +5 -4
- package/common/utils/getVehiclePosition.js +9 -3
- package/common/utils/renderTrajectories.d.ts +1 -1
- package/common/utils/renderTrajectories.js +6 -6
- package/common/utils/sortAndFilterDepartures.d.ts +1 -1
- package/common/utils/sortAndFilterDepartures.js +1 -1
- package/common/utils/sortByDelay.d.ts +2 -2
- package/common/utils/sortByDelay.js +5 -1
- package/maplibre/layers/Layer.d.ts +1 -1
- package/maplibre/layers/Layer.js +1 -1
- package/maplibre/layers/RealtimeLayer.d.ts +87 -66
- package/maplibre/layers/RealtimeLayer.js +30 -6
- package/maplibre/utils/getSourceCoordinates.js +5 -5
- package/mbt.js +20988 -13287
- package/mbt.js.map +4 -4
- package/mbt.min.js +61 -58
- package/mbt.min.js.map +4 -4
- package/ol/controls/RoutingControl.d.ts +82 -89
- package/ol/controls/RoutingControl.js +217 -219
- package/ol/controls/StopFinderControl.d.ts +3 -3
- package/ol/controls/StopFinderControl.js +2 -2
- package/ol/index.d.ts +1 -0
- package/ol/index.js +1 -0
- package/ol/layers/Layer.d.ts +101 -0
- package/ol/layers/Layer.js +25 -0
- package/ol/layers/MaplibreLayer.d.ts +121 -24
- package/ol/layers/MaplibreLayer.js +98 -27
- package/ol/layers/MaplibreStyleLayer.d.ts +93 -91
- package/ol/layers/MaplibreStyleLayer.js +281 -257
- package/ol/layers/RealtimeLayer.d.ts +119 -121
- package/ol/layers/RealtimeLayer.js +143 -134
- package/ol/layers/VectorLayer.d.ts +18 -0
- package/ol/layers/VectorLayer.js +32 -0
- package/ol/layers/index.d.ts +2 -0
- package/ol/layers/index.js +3 -0
- package/ol/mixins/MobilityLayerMixin.d.ts +32 -34
- package/ol/mixins/PropertiesLayerMixin.d.ts +60 -51
- package/ol/mixins/PropertiesLayerMixin.js +114 -79
- package/ol/mixins/index.d.ts +1 -0
- package/ol/mixins/index.js +2 -0
- package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
- package/ol/renderers/MaplibreLayerRenderer.js +142 -114
- package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
- package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
- package/ol/renderers/RealtimeLayerRenderer.d.ts +6 -6
- package/ol/renderers/RealtimeLayerRenderer.js +56 -51
- package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
- package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
- package/package.json +31 -31
- package/setupTests.js +3 -4
- package/types/common.d.ts +55 -48
- package/types/index.d.ts +1 -1
- package/types/realtime.d.ts +91 -93
- package/types/routing.d.ts +60 -60
- package/types/stops.d.ts +62 -62
- package/ol/layers/MapGlLayer.d.ts +0 -144
- package/ol/layers/MapGlLayer.js +0 -144
package/api/RealtimeAPI.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
/* eslint-disable class-methods-use-this */
|
|
3
|
-
import WebSocketAPI from './WebSocketAPI';
|
|
4
2
|
import debounceWebsocketMessages from '../common/utils/debounceWebsocketMessages';
|
|
5
3
|
import getModeSuffix from '../common/utils/getRealtimeModeSuffix';
|
|
4
|
+
/* eslint-disable class-methods-use-this */
|
|
5
|
+
import WebSocketAPI from './WebSocketAPI';
|
|
6
6
|
/**
|
|
7
7
|
* Enum for Realtime modes.
|
|
8
8
|
* @readonly
|
|
@@ -11,14 +11,15 @@ import getModeSuffix from '../common/utils/getRealtimeModeSuffix';
|
|
|
11
11
|
* @property {string} SCHEMATIC "schematic"
|
|
12
12
|
* @property {string} TOPOGRAPHIC "topographic"
|
|
13
13
|
* @enum {RealtimeMode}
|
|
14
|
+
* @public
|
|
14
15
|
*/
|
|
15
16
|
export const RealtimeModes = {
|
|
16
17
|
RAW: 'raw',
|
|
17
|
-
TOPOGRAPHIC: 'topographic',
|
|
18
18
|
SCHEMATIC: 'schematic',
|
|
19
|
+
TOPOGRAPHIC: 'topographic',
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
|
-
* This class provides convenience methods to use to the [geOps
|
|
22
|
+
* This class provides convenience methods to use to the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
22
23
|
*
|
|
23
24
|
* @example
|
|
24
25
|
* import { RealtimeAPI } from 'mobility-toolbox-js/api';
|
|
@@ -29,86 +30,27 @@ export const RealtimeModes = {
|
|
|
29
30
|
* // url: "wss://api.geops.io/tracker-ws/v1/",
|
|
30
31
|
* });
|
|
31
32
|
*
|
|
33
|
+
* // Open the websocket connection
|
|
32
34
|
* api.open();
|
|
33
35
|
*
|
|
36
|
+
* // Subscribe to channel
|
|
34
37
|
* api.subscribeTrajectory('topographic', (data) => {
|
|
35
38
|
* console.log('Log trajectories:', JSON.stringify(data.content));
|
|
36
39
|
* });
|
|
37
40
|
*
|
|
41
|
+
* // Close the websocket connection
|
|
42
|
+
* // api.close();
|
|
43
|
+
*
|
|
38
44
|
* @public
|
|
39
45
|
*/
|
|
40
46
|
class RealtimeAPI {
|
|
41
|
-
get url() {
|
|
42
|
-
return this._url;
|
|
43
|
-
}
|
|
44
|
-
set url(newUrl) {
|
|
45
|
-
if (this._url !== newUrl) {
|
|
46
|
-
this._url = newUrl;
|
|
47
|
-
// Update the websocket only if the url has changed and the websocket is already open or is opening.
|
|
48
|
-
if (this.wsApi.open || this.wsApi.connecting) {
|
|
49
|
-
this.open();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The bounding box to receive data from.\
|
|
55
|
-
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
56
|
-
* \
|
|
57
|
-
* Where:
|
|
58
|
-
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
59
|
-
*
|
|
60
|
-
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
61
|
-
*
|
|
62
|
-
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
63
|
-
*
|
|
64
|
-
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
65
|
-
*
|
|
66
|
-
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
67
|
-
*
|
|
68
|
-
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
69
|
-
* Example: "mots=rail,subway".\
|
|
70
|
-
*
|
|
71
|
-
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
72
|
-
* Example: "gen_level=5"\
|
|
73
|
-
*
|
|
74
|
-
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
75
|
-
* Example: "tenant=sbb"\
|
|
76
|
-
*
|
|
77
|
-
* - ...: Any other values added to the bbox will be send to the server
|
|
78
|
-
*
|
|
79
|
-
* @type {string[]}
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
get bbox() {
|
|
84
|
-
return this._bbox;
|
|
85
|
-
}
|
|
86
|
-
set bbox(newBbox) {
|
|
87
|
-
if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
|
|
88
|
-
this._bbox = newBbox;
|
|
89
|
-
if (this.wsApi && this._bbox) {
|
|
90
|
-
this.wsApi.send(`BBOX ${this._bbox.join(' ')}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
get buffer() {
|
|
95
|
-
return this._buffer;
|
|
96
|
-
}
|
|
97
|
-
set buffer(newBuffer) {
|
|
98
|
-
if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
|
|
99
|
-
this._buffer = newBuffer;
|
|
100
|
-
if (this.wsApi && this._buffer) {
|
|
101
|
-
this.wsApi.send(`BUFFER ${this._buffer.join(' ')}`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
47
|
/**
|
|
106
48
|
* Constructor
|
|
107
49
|
*
|
|
108
|
-
* @param {Object} options
|
|
109
|
-
* @param {string} options.url Url to the [geOps realtime API](https://developer.geops.io/apis/realtime/).
|
|
50
|
+
* @param {Object} options Options.
|
|
110
51
|
* @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
|
|
111
52
|
* @param {string[]} options.bbox The bounding box to receive data from.
|
|
53
|
+
* @param {string} [options.url='wss://api.geops.io/tracker-ws/v1/'] Url of the [geOps Realtime API](https://developer.geops.io/apis/realtime/).
|
|
112
54
|
* @public
|
|
113
55
|
*/
|
|
114
56
|
constructor(options = {}) {
|
|
@@ -126,6 +68,7 @@ class RealtimeAPI {
|
|
|
126
68
|
}
|
|
127
69
|
this._url = (url || 'wss://api.geops.io/tracker-ws/v1/') + suffix;
|
|
128
70
|
this._buffer = opt.buffer || [100, 100];
|
|
71
|
+
this._bbox = opt.bbox;
|
|
129
72
|
this.version = opt.version || '2';
|
|
130
73
|
/**
|
|
131
74
|
* Interval between PING request in ms.
|
|
@@ -144,32 +87,111 @@ class RealtimeAPI {
|
|
|
144
87
|
this.wsApi = wsApi;
|
|
145
88
|
}
|
|
146
89
|
/**
|
|
147
|
-
*
|
|
90
|
+
* Close the websocket connection without reconnection.
|
|
148
91
|
*
|
|
149
92
|
* @public
|
|
150
93
|
*/
|
|
151
|
-
|
|
152
|
-
this.wsApi.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
94
|
+
close() {
|
|
95
|
+
this.wsApi.close();
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Send GET to a channel.
|
|
99
|
+
*
|
|
100
|
+
* @param {string | WebSocketAPIParameters} channelOrParams Name of the websocket channel to send GET or an object representing parameters to send
|
|
101
|
+
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
get(channelOrParams) {
|
|
105
|
+
let params = channelOrParams;
|
|
106
|
+
if (typeof channelOrParams === 'string') {
|
|
107
|
+
params = { channel: channelOrParams };
|
|
158
108
|
}
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
this.wsApi.get(params, resolve, reject);
|
|
111
|
+
});
|
|
159
112
|
}
|
|
160
113
|
/**
|
|
161
|
-
*
|
|
114
|
+
* Get a full trajectory of a vehicule .
|
|
162
115
|
*
|
|
116
|
+
* @param {string} id A vehicle id.
|
|
117
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
118
|
+
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
119
|
+
* @return {Promise<{data: { content: RealtimeFullTrajectory }}>} Return a full trajectory.
|
|
163
120
|
* @public
|
|
164
121
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
122
|
+
getFullTrajectory(id, mode, generalizationLevel) {
|
|
123
|
+
let suffix = '';
|
|
124
|
+
if (this.version === '1') {
|
|
125
|
+
suffix = getModeSuffix(mode, RealtimeModes);
|
|
126
|
+
}
|
|
127
|
+
const channel = [`full_trajectory${suffix}`];
|
|
128
|
+
if (id) {
|
|
129
|
+
channel.push(id);
|
|
130
|
+
}
|
|
131
|
+
if ((!mode || mode === RealtimeModes.TOPOGRAPHIC) && generalizationLevel) {
|
|
132
|
+
channel.push(`gen${generalizationLevel}`);
|
|
133
|
+
}
|
|
134
|
+
return this.get(channel.join('_'));
|
|
167
135
|
}
|
|
168
136
|
/**
|
|
169
|
-
*
|
|
137
|
+
* Return a station with a given uic number and a mode.
|
|
138
|
+
*
|
|
139
|
+
* @param {number} uic UIC of the station.
|
|
140
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
141
|
+
* @return {Promise<{data: { content: RealtimeStation }}>} A station.
|
|
142
|
+
* @public
|
|
170
143
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
144
|
+
getStation(uic, mode) {
|
|
145
|
+
const params = {
|
|
146
|
+
args: uic,
|
|
147
|
+
channel: `station${getModeSuffix(mode, RealtimeModes)}`,
|
|
148
|
+
};
|
|
149
|
+
return this.get(params);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get the list of ststions available for a specifc mode. The promise is resolved every 100ms
|
|
153
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
154
|
+
* @param {number} timeout = 100 Duration in ms between each promise resolve calls.
|
|
155
|
+
* @return {Promise<RealtimeStation[]>} An array of stations.
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
158
|
+
getStations(mode, timeout = 100) {
|
|
159
|
+
return new Promise((resolve) => {
|
|
160
|
+
this.get(`station${getModeSuffix(mode, RealtimeModes)}`).then(debounceWebsocketMessages(resolve, undefined, timeout));
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get the list of stops for this vehicle.
|
|
165
|
+
*
|
|
166
|
+
* @param {string} id A vehicle id.
|
|
167
|
+
* @return {Promise<{data: { content: RealtimeStopSequence[] }}>} Returns a stop sequence object.
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
getStopSequence(id) {
|
|
171
|
+
return this.get(`stopsequence_${id}`);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Return a partial trajectory with a given id and a mode.
|
|
175
|
+
*
|
|
176
|
+
* @param {number} id The identifier of a trajectory.
|
|
177
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
178
|
+
* @return {Promise<{data: { content: RealtimeTrajectory }}>} A trajectory.
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
getTrajectory(id, mode) {
|
|
182
|
+
return this.get(`partial_trajectory${getModeSuffix(mode, RealtimeModes)}_${id}`);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Callback when the websocket is closed by the server.
|
|
186
|
+
* It auto reconnects after a timeout.
|
|
187
|
+
* @private
|
|
188
|
+
*/
|
|
189
|
+
onClose() {
|
|
190
|
+
window.clearTimeout(this.pingInterval);
|
|
191
|
+
window.clearTimeout(this.reconnectTimeout);
|
|
192
|
+
if (this.reconnectTimeoutMs) {
|
|
193
|
+
this.reconnectTimeout = window.setTimeout(() => this.open(), this.reconnectTimeoutMs);
|
|
194
|
+
}
|
|
173
195
|
}
|
|
174
196
|
/**
|
|
175
197
|
* Callback when the websocket is opened and ready.
|
|
@@ -194,31 +216,24 @@ class RealtimeAPI {
|
|
|
194
216
|
}
|
|
195
217
|
}
|
|
196
218
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* @
|
|
219
|
+
* Open the websocket connection.
|
|
220
|
+
*
|
|
221
|
+
* @public
|
|
200
222
|
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (this.
|
|
205
|
-
this.
|
|
223
|
+
open() {
|
|
224
|
+
this.wsApi.connect(this.url, this.onOpen.bind(this));
|
|
225
|
+
// Register reconnection on close.
|
|
226
|
+
if (this.wsApi.websocket) {
|
|
227
|
+
this.wsApi.websocket.onclose = () => {
|
|
228
|
+
this.onClose();
|
|
229
|
+
};
|
|
206
230
|
}
|
|
207
231
|
}
|
|
208
232
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* @param {string | WebSocketAPIParameters} channelOrParams Name of the websocket channel to send GET or an object representing parameters to send
|
|
212
|
-
* @return {Promise<WebSocketAPIMessageEventData<?>>} A websocket response.
|
|
233
|
+
* Unsubscribe trajectory and deleted_vehicles channels. To resubscribe you have to set a new BBOX.
|
|
213
234
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (typeof channelOrParams === 'string') {
|
|
217
|
-
params = { channel: channelOrParams };
|
|
218
|
-
}
|
|
219
|
-
return new Promise((resolve, reject) => {
|
|
220
|
-
this.wsApi.get(params, resolve, reject);
|
|
221
|
-
});
|
|
235
|
+
reset() {
|
|
236
|
+
this.wsApi.send('RESET');
|
|
222
237
|
}
|
|
223
238
|
/**
|
|
224
239
|
* Subscribe to a channel.
|
|
@@ -227,7 +242,7 @@ class RealtimeAPI {
|
|
|
227
242
|
* @param {function} onSuccess Callback when the subscription succeeds.
|
|
228
243
|
* @param {function} onError Callback when the subscription fails.
|
|
229
244
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
230
|
-
* @
|
|
245
|
+
* @public
|
|
231
246
|
*/
|
|
232
247
|
subscribe(channel, onSuccess, onError = () => { }, quiet = false) {
|
|
233
248
|
if (!channel || !onSuccess) {
|
|
@@ -236,87 +251,93 @@ class RealtimeAPI {
|
|
|
236
251
|
this.wsApi.subscribe({ channel }, onSuccess, onError, quiet);
|
|
237
252
|
}
|
|
238
253
|
/**
|
|
239
|
-
*
|
|
254
|
+
* Subscribe to deleted_vhicles channel.
|
|
240
255
|
*
|
|
241
|
-
* @param {
|
|
242
|
-
* @param {
|
|
243
|
-
* @param {function}
|
|
244
|
-
* @
|
|
256
|
+
* @param {RealtimeMode} mode Realtime mode.
|
|
257
|
+
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
258
|
+
* @param {function} onError Callback when the subscription fails.
|
|
259
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
260
|
+
* @public
|
|
245
261
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.
|
|
250
|
-
|
|
262
|
+
subscribeDeletedVehicles(mode, onMessage, onError = () => { }, quiet = false) {
|
|
263
|
+
this.unsubscribeDeletedVehicles(onMessage);
|
|
264
|
+
let suffix = '';
|
|
265
|
+
if (this.version === '1') {
|
|
266
|
+
suffix = getModeSuffix(mode, RealtimeModes);
|
|
267
|
+
}
|
|
268
|
+
this.subscribe(`deleted_vehicles${suffix}`, onMessage, onError, quiet);
|
|
251
269
|
}
|
|
252
270
|
/**
|
|
253
271
|
* Subscribe to departures channel of a given station.
|
|
254
272
|
*
|
|
255
273
|
* @param {number} stationId UIC of the station.
|
|
256
|
-
* @param {
|
|
257
|
-
* @param {function(departures:Departure[])} onMessage Function called on each message of the channel.
|
|
274
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
258
275
|
* @param {function} onError Callback when the subscription fails.
|
|
259
276
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
260
|
-
* @
|
|
277
|
+
* @deprecated Use subscribeTimetable instead.
|
|
261
278
|
*/
|
|
262
279
|
subscribeDepartures(stationId, onMessage, onError = () => { }, quiet = false) {
|
|
263
|
-
this.
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Unsubscribe from current departures channel.
|
|
267
|
-
* @param {RealtimeStationId} id Station's id
|
|
268
|
-
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
269
|
-
* @public
|
|
270
|
-
*/
|
|
271
|
-
unsubscribeDepartures(id, onMessage) {
|
|
272
|
-
this.unsubscribe(`timetable_${id}`, '', onMessage);
|
|
280
|
+
this.subscribeTimetable(stationId, onMessage, onError, quiet);
|
|
273
281
|
}
|
|
274
282
|
/**
|
|
275
283
|
* Subscribe to the disruptions channel for tenant.
|
|
276
284
|
*
|
|
285
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
277
286
|
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
278
287
|
* @param {function} onError Callback when the subscription fails.
|
|
279
288
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
280
|
-
* @
|
|
289
|
+
* @deprecated Use subscribeNewsticker instead.
|
|
281
290
|
*/
|
|
282
291
|
subscribeDisruptions(tenant, onMessage, onError = () => { }, quiet = false) {
|
|
283
|
-
this.
|
|
292
|
+
this.subscribeNewsticker(tenant, onMessage, onError, quiet);
|
|
284
293
|
}
|
|
285
294
|
/**
|
|
286
|
-
*
|
|
295
|
+
* Subscribe to extra_geoms channel.
|
|
287
296
|
*
|
|
288
|
-
* @param {function(data: { content:
|
|
289
|
-
* @
|
|
297
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Function called on each message of the channel.
|
|
298
|
+
* @param {function} onError Callback when the subscription fails.
|
|
299
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
290
300
|
*/
|
|
291
|
-
|
|
292
|
-
this.
|
|
301
|
+
subscribeExtraGeoms(onMessage, onError = () => { }, quiet = false) {
|
|
302
|
+
this.subscribe('extra_geoms', onMessage, onError, quiet);
|
|
293
303
|
}
|
|
294
304
|
/**
|
|
295
|
-
*
|
|
305
|
+
* Subscribe to full_trajectory channel of a given vehicle.
|
|
296
306
|
*
|
|
297
|
-
* @param {
|
|
307
|
+
* @param {string} id A vehicle id.
|
|
298
308
|
* @param {RealtimeMode} mode Realtime mode.
|
|
299
|
-
* @
|
|
309
|
+
* @param {function(data:{content: RealtimeFullTrajectory})} onMessage Function called on each message of the channel.
|
|
310
|
+
* @param {function} onError Callback when the subscription fails.
|
|
311
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
300
312
|
* @public
|
|
301
313
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
314
|
+
subscribeFullTrajectory(id, mode, onMessage, onError = () => { }, quiet = false) {
|
|
315
|
+
let suffix = '';
|
|
316
|
+
if (this.version === '1') {
|
|
317
|
+
suffix = getModeSuffix(mode, RealtimeModes);
|
|
318
|
+
}
|
|
319
|
+
this.subscribe(`full_trajectory${suffix}_${id}`, onMessage, onError, quiet);
|
|
308
320
|
}
|
|
309
321
|
/**
|
|
310
|
-
*
|
|
311
|
-
* @param {
|
|
312
|
-
* @param {
|
|
313
|
-
* @
|
|
322
|
+
* Subscribe to healthcheck channel.
|
|
323
|
+
* @param {function(data: { content: string })} onMessage Callback when the subscribe to healthcheck channel succeeds.
|
|
324
|
+
* @param {function} onError Callback when the subscription fails.
|
|
325
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
326
|
+
*/
|
|
327
|
+
subscribeHealthCheck(onMessage, onError = () => { }, quiet = false) {
|
|
328
|
+
this.subscribe('healthcheck', onMessage, onError, quiet);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Subscribe to the newsticker channel for tenant.
|
|
332
|
+
*
|
|
333
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
334
|
+
* @param {function(data: { content: RealtimeNews[] })} onMessage Function called on each message of the channel.
|
|
335
|
+
* @param {function} onError Callback when the subscription fails.
|
|
336
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
314
337
|
* @public
|
|
315
338
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
this.get(`station${getModeSuffix(mode, RealtimeModes)}`).then(debounceWebsocketMessages(resolve, undefined, timeout));
|
|
319
|
-
});
|
|
339
|
+
subscribeNewsticker(tenant, onMessage, onError = () => { }, quiet = false) {
|
|
340
|
+
this.subscribe(`${tenant}_newsticker`, onMessage, onError, quiet);
|
|
320
341
|
}
|
|
321
342
|
/**
|
|
322
343
|
* Subscribe to stations channel.
|
|
@@ -332,46 +353,34 @@ class RealtimeAPI {
|
|
|
332
353
|
this.subscribe(`station${getModeSuffix(mode, RealtimeModes)}`, onMessage, onError, quiet);
|
|
333
354
|
}
|
|
334
355
|
/**
|
|
335
|
-
*
|
|
336
|
-
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
337
|
-
* @public
|
|
338
|
-
*/
|
|
339
|
-
unsubscribeStations(onMessage) {
|
|
340
|
-
this.unsubscribe('station', '', onMessage);
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Subscribe to extra_geoms channel.
|
|
356
|
+
* Subscribe to stopsequence channel of a given vehicle.
|
|
344
357
|
*
|
|
345
|
-
* @param {
|
|
358
|
+
* @param {string} id A vehicle id.
|
|
359
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Function called on each message of the channel.
|
|
346
360
|
* @param {function} onError Callback when the subscription fails.
|
|
347
361
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
362
|
+
* @public
|
|
348
363
|
*/
|
|
349
|
-
|
|
350
|
-
this.subscribe(
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Unsubscribe to extra_geoms channel.
|
|
354
|
-
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
355
|
-
*/
|
|
356
|
-
unsubscribeExtraGeoms(onMessage) {
|
|
357
|
-
this.unsubscribe('extra_geoms', '', onMessage);
|
|
364
|
+
subscribeStopSequence(id, onMessage, onError = () => { }, quiet = false) {
|
|
365
|
+
this.subscribe(`stopsequence_${id}`, onMessage, onError, quiet);
|
|
358
366
|
}
|
|
359
367
|
/**
|
|
360
|
-
*
|
|
368
|
+
* Subscribe to timetable channel of a given station.
|
|
361
369
|
*
|
|
362
|
-
* @param {number}
|
|
363
|
-
* @param {
|
|
364
|
-
* @
|
|
370
|
+
* @param {number} stationId UIC of the station.
|
|
371
|
+
* @param {function(departures: RealtimeDeparture[])} onMessage Function called on each message of the channel.
|
|
372
|
+
* @param {function} onError Callback when the subscription fails.
|
|
373
|
+
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
365
374
|
* @public
|
|
366
375
|
*/
|
|
367
|
-
|
|
368
|
-
|
|
376
|
+
subscribeTimetable(stationId, onMessage, onError = () => { }, quiet = false) {
|
|
377
|
+
this.subscribe(`timetable_${stationId}`, onMessage, onError, quiet);
|
|
369
378
|
}
|
|
370
379
|
/**
|
|
371
380
|
* Subscribe to trajectory channel.
|
|
372
381
|
*
|
|
373
382
|
* @param {RealtimeMode} mode Realtime mode.
|
|
374
|
-
* @param {function(data: { content:
|
|
383
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Function called on each message of the channel.
|
|
375
384
|
* @param {function} onError Callback when the subscription fails.
|
|
376
385
|
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
377
386
|
* @public
|
|
@@ -385,133 +394,183 @@ class RealtimeAPI {
|
|
|
385
394
|
this.subscribe(`trajectory${suffix}`, onMessage, onError, quiet);
|
|
386
395
|
}
|
|
387
396
|
/**
|
|
388
|
-
* Unsubscribe
|
|
389
|
-
* @param {function(data: { content: RealtimeTrajectoryResponse[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
392
|
-
unsubscribeTrajectory(onMessage) {
|
|
393
|
-
this.unsubscribe(`trajectory`, '', onMessage);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Subscribe to deleted_vhicles channel.
|
|
397
|
+
* Unsubscribe both modes of a channel.
|
|
397
398
|
*
|
|
398
|
-
* @param {
|
|
399
|
-
* @param {
|
|
400
|
-
* @param {function}
|
|
401
|
-
* @
|
|
399
|
+
* @param {string} channel Name of the websocket channel to unsubscribe.
|
|
400
|
+
* @param {string} suffix Suffix to add to the channel name.
|
|
401
|
+
* @param {function} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
402
|
+
* @public
|
|
402
403
|
*/
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
this.subscribe(`deleted_vehicles${suffix}`, onMessage, onError, quiet);
|
|
404
|
+
unsubscribe(channel, suffix = '', onMessage) {
|
|
405
|
+
const suffixSchenatic = getModeSuffix(RealtimeModes.SCHEMATIC, RealtimeModes);
|
|
406
|
+
const suffixTopographic = getModeSuffix(RealtimeModes.TOPOGRAPHIC, RealtimeModes);
|
|
407
|
+
this.wsApi.unsubscribe(`${channel}${suffixSchenatic}${suffix || ''}`, onMessage);
|
|
408
|
+
this.wsApi.unsubscribe(`${channel}${suffixTopographic}${suffix || ''}`, onMessage);
|
|
410
409
|
}
|
|
411
410
|
/**
|
|
412
411
|
* Unsubscribe to deleted_vhicles channels.
|
|
413
412
|
* @param {function(data: { content: RealtimeTrainId })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
413
|
+
* @public
|
|
414
414
|
*/
|
|
415
415
|
unsubscribeDeletedVehicles(onMessage) {
|
|
416
416
|
this.unsubscribe('deleted_vehicles', '', onMessage);
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* @param {
|
|
422
|
-
* @
|
|
423
|
-
* @param {string} generalizationLevel The generalization level to request. Can be one of 5 (more generalized), 10, 30, 100, undefined (less generalized).
|
|
424
|
-
* @return {Promise<{ data: { content: RealtimeFullTrajectory } }>} Return a full trajectory.
|
|
425
|
-
* @public
|
|
419
|
+
* Unsubscribe from current departures channel.
|
|
420
|
+
* @param {number} stationId UIC of the station.
|
|
421
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
422
|
+
* @deprecated Use RealtimeAPI.unsubscribeTimetabe instead.
|
|
426
423
|
*/
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (this.version === '1') {
|
|
430
|
-
suffix = getModeSuffix(mode, RealtimeModes);
|
|
431
|
-
}
|
|
432
|
-
const channel = [`full_trajectory${suffix}`];
|
|
433
|
-
if (id) {
|
|
434
|
-
channel.push(id);
|
|
435
|
-
}
|
|
436
|
-
if ((!mode || mode === RealtimeModes.TOPOGRAPHIC) && generalizationLevel) {
|
|
437
|
-
channel.push(`gen${generalizationLevel}`);
|
|
438
|
-
}
|
|
439
|
-
return this.get(channel.join('_'));
|
|
424
|
+
unsubscribeDepartures(stationId, onMessage) {
|
|
425
|
+
this.unsubscribeTimetabe(stationId, onMessage);
|
|
440
426
|
}
|
|
441
427
|
/**
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
* @param {
|
|
445
|
-
* @
|
|
446
|
-
* @param {function(data: { content: RealtimeFullTrajectory })} onMessage Function called on each message of the channel.
|
|
447
|
-
* @param {function} onError Callback when the subscription fails.
|
|
448
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
449
|
-
* @public
|
|
428
|
+
* Unsubscribe disruptions.
|
|
429
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
430
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
431
|
+
* @deprecated Use unsubscribeNewsticker instead.
|
|
450
432
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
433
|
+
unsubscribeDisruptions(tenant, onMessage) {
|
|
434
|
+
this.unsubscribeNewsticker(tenant, onMessage);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Unsubscribe to extra_geoms channel.
|
|
438
|
+
* @param {function(data: { content: RealtimeExtraGeom })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
439
|
+
*/
|
|
440
|
+
unsubscribeExtraGeoms(onMessage) {
|
|
441
|
+
this.unsubscribe('extra_geoms', '', onMessage);
|
|
457
442
|
}
|
|
458
443
|
/**
|
|
459
444
|
* Unsubscribe from full_trajectory channel
|
|
460
445
|
*
|
|
461
446
|
* @param {string} id A vehicle id.
|
|
462
|
-
* @param {
|
|
447
|
+
* @param {onFullTrajectoryMessageCallback} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
463
448
|
* @public
|
|
464
449
|
*/
|
|
465
450
|
unsubscribeFullTrajectory(id, onMessage) {
|
|
466
451
|
this.unsubscribe('full_trajectory', `_${id}`, onMessage);
|
|
467
452
|
}
|
|
468
453
|
/**
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
|
|
472
|
-
|
|
454
|
+
* Unsubscribe to healthcheck channel.
|
|
455
|
+
* @param {function(data: { content: string })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
456
|
+
*/
|
|
457
|
+
unsubscribeHealthCheck(onMessage) {
|
|
458
|
+
this.unsubscribe('healthcheck', '', onMessage);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Unsubscribe disruptions.
|
|
462
|
+
* @param {RealtimeTenant} tenant Tenant's id
|
|
463
|
+
* @param {Function(data: { content: RealtimeNews[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
473
464
|
* @public
|
|
474
465
|
*/
|
|
475
|
-
|
|
476
|
-
|
|
466
|
+
unsubscribeNewsticker(tenant, onMessage) {
|
|
467
|
+
this.unsubscribe(`${tenant}_newsticker`, '', onMessage);
|
|
477
468
|
}
|
|
478
469
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
* @param {string} id A vehicle id.
|
|
482
|
-
* @param {function(data: { content: StopSequence[] })} onMessage Function called on each message of the channel.
|
|
483
|
-
* @param {function} onError Callback when the subscription fails.
|
|
484
|
-
* @param {boolean} [quiet=false] If true avoid to store the subscription in the subscriptions list.
|
|
470
|
+
* Unsubscribe to stations channel.
|
|
471
|
+
* @param {function(data: { content: RealtimeStation })} onMessage The listener callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribe.
|
|
485
472
|
* @public
|
|
486
473
|
*/
|
|
487
|
-
|
|
488
|
-
this.
|
|
474
|
+
unsubscribeStations(onMessage) {
|
|
475
|
+
this.unsubscribe('station', '', onMessage);
|
|
489
476
|
}
|
|
490
477
|
/**
|
|
491
478
|
* Unsubscribe from stopsequence channel
|
|
492
479
|
*
|
|
493
480
|
* @param {string} id A vehicle id.
|
|
494
|
-
* @param {function(data: { content:
|
|
481
|
+
* @param {function(data: { content: RealtimeStopSequence[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
495
482
|
* @public
|
|
496
483
|
*/
|
|
497
484
|
unsubscribeStopSequence(id, onMessage) {
|
|
498
485
|
this.unsubscribe(`stopsequence`, `_${id}`, onMessage);
|
|
499
486
|
}
|
|
500
487
|
/**
|
|
501
|
-
*
|
|
502
|
-
* @param {
|
|
503
|
-
* @param {function}
|
|
504
|
-
* @
|
|
488
|
+
* Unsubscribe from current departures channel.
|
|
489
|
+
* @param {number} stationId UIC of the station.
|
|
490
|
+
* @param {function(data: { content: RealtimeDeparture[] })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
491
|
+
* @public
|
|
505
492
|
*/
|
|
506
|
-
|
|
507
|
-
this.
|
|
493
|
+
unsubscribeTimetabe(stationId, onMessage) {
|
|
494
|
+
this.unsubscribe(`timetable_${stationId}`, '', onMessage);
|
|
508
495
|
}
|
|
509
496
|
/**
|
|
510
|
-
* Unsubscribe to
|
|
511
|
-
* @param {function(data: { content:
|
|
497
|
+
* Unsubscribe to trajectory channels.
|
|
498
|
+
* @param {function(data: { content: RealtimeTrajectory })} onMessage Callback function to unsubscribe. If null all subscriptions for the channel will be unsubscribed.
|
|
499
|
+
* @public
|
|
512
500
|
*/
|
|
513
|
-
|
|
514
|
-
this.unsubscribe(
|
|
501
|
+
unsubscribeTrajectory(onMessage) {
|
|
502
|
+
this.unsubscribe(`trajectory`, '', onMessage);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* This callback type is called `requestCallback` and is displayed as a global symbol.
|
|
506
|
+
*
|
|
507
|
+
* @callback onFullTrajectoryMessageCallback
|
|
508
|
+
* @param {number} responseCode
|
|
509
|
+
* @param {string} responseMessage
|
|
510
|
+
*/
|
|
511
|
+
/**
|
|
512
|
+
* The bounding box to receive data from.\
|
|
513
|
+
* Example: [minX, minY, maxX, maxY, zoom, mots , gen_level, tenant, ...]\
|
|
514
|
+
* \
|
|
515
|
+
* Where:
|
|
516
|
+
* - **minX**: a string representation of an integer (not a float) representing the minimal X coordinate (in EPSG:3857) of a bounding box\
|
|
517
|
+
*
|
|
518
|
+
* - **minY**: a string representation of an integer (not a float) representing the minimal Y coordinate (in EPSG:3857) of a bounding box\
|
|
519
|
+
*
|
|
520
|
+
* - **maxX**: a string representation of an integer (not a float) representing the maximal X coordinate (in EPSG:3857) of a bounding box\
|
|
521
|
+
*
|
|
522
|
+
* - **maxY**: a string representation of an integer (not a float) representing the maximal Y coordinate (in EPSG:3857) of a bounding box\
|
|
523
|
+
*
|
|
524
|
+
* - **zoom**: a string representation of an integer representing the zoom level (from 4 to 22). When zoom < 8 only the trains are displayed for performance reasons.\
|
|
525
|
+
*
|
|
526
|
+
* - **mots**: A comma separated list of modes of transport. **Optional**.\
|
|
527
|
+
* Example: "mots=rail,subway".\
|
|
528
|
+
*
|
|
529
|
+
* - **gen_level**: An integer representing the generalization level. **Optional**.\
|
|
530
|
+
* Example: "gen_level=5"\
|
|
531
|
+
*
|
|
532
|
+
* - **tenant**: A string representing the tenant. **Optional**.\
|
|
533
|
+
* Example: "tenant=sbb"\
|
|
534
|
+
*
|
|
535
|
+
* - ...: Any other values added to the bbox will be send to the server
|
|
536
|
+
*
|
|
537
|
+
* @type {string[]}
|
|
538
|
+
*
|
|
539
|
+
* @public
|
|
540
|
+
*/
|
|
541
|
+
get bbox() {
|
|
542
|
+
return this._bbox;
|
|
543
|
+
}
|
|
544
|
+
set bbox(newBbox) {
|
|
545
|
+
if (JSON.stringify(newBbox) !== JSON.stringify(this._bbox)) {
|
|
546
|
+
this._bbox = newBbox;
|
|
547
|
+
if (this.wsApi && this._bbox) {
|
|
548
|
+
this.wsApi.send(`BBOX ${this._bbox.join(' ')}`);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
get buffer() {
|
|
553
|
+
return this._buffer;
|
|
554
|
+
}
|
|
555
|
+
set buffer(newBuffer) {
|
|
556
|
+
if (JSON.stringify(newBuffer) !== JSON.stringify(this._buffer)) {
|
|
557
|
+
this._buffer = newBuffer;
|
|
558
|
+
if (this.wsApi && this._buffer) {
|
|
559
|
+
this.wsApi.send(`BUFFER ${this._buffer.join(' ')}`);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
get url() {
|
|
564
|
+
return this._url;
|
|
565
|
+
}
|
|
566
|
+
set url(newUrl) {
|
|
567
|
+
if (this._url !== newUrl) {
|
|
568
|
+
this._url = newUrl;
|
|
569
|
+
// Update the websocket only if the url has changed and the websocket is already open or is opening.
|
|
570
|
+
if (this.wsApi.open || this.wsApi.connecting) {
|
|
571
|
+
this.open();
|
|
572
|
+
}
|
|
573
|
+
}
|
|
515
574
|
}
|
|
516
575
|
}
|
|
517
576
|
export default RealtimeAPI;
|