mobility-toolbox-js 3.0.0-beta.9 → 3.0.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.
Files changed (105) hide show
  1. package/README.md +11 -3
  2. package/api/HttpAPI.d.ts +5 -16
  3. package/api/HttpAPI.js +1 -14
  4. package/api/RealtimeAPI.d.ts +188 -143
  5. package/api/RealtimeAPI.js +265 -206
  6. package/api/RoutingAPI.d.ts +21 -11
  7. package/api/RoutingAPI.js +17 -7
  8. package/api/StopsAPI.d.ts +20 -14
  9. package/api/StopsAPI.js +17 -11
  10. package/api/WebSocketAPI.d.ts +60 -66
  11. package/api/WebSocketAPI.js +164 -165
  12. package/api/index.js +1 -1
  13. package/api/typedefs.d.ts +0 -102
  14. package/api/typedefs.js +27 -42
  15. package/common/controls/StopFinderControlCommon.d.ts +13 -13
  16. package/common/controls/StopFinderControlCommon.js +32 -32
  17. package/common/index.d.ts +1 -1
  18. package/common/index.js +1 -1
  19. package/common/styles/realtimeDefaultStyle.js +6 -11
  20. package/common/styles/realtimeHeadingStyle.js +5 -10
  21. package/common/styles/realtimeSimpleStyle.d.ts +0 -1
  22. package/common/styles/realtimeSimpleStyle.js +0 -1
  23. package/common/typedefs.d.ts +11 -121
  24. package/common/typedefs.js +6 -31
  25. package/common/utils/RealtimeEngine.d.ts +214 -0
  26. package/common/utils/RealtimeEngine.js +554 -0
  27. package/common/utils/compareDepartures.d.ts +2 -2
  28. package/common/utils/compareDepartures.js +2 -2
  29. package/common/utils/debounceWebsocketMessages.d.ts +1 -1
  30. package/common/utils/getLayersAsFlatArray.d.ts +0 -1
  31. package/common/utils/getLayersAsFlatArray.js +0 -1
  32. package/common/utils/getMapGlCopyrights.d.ts +1 -1
  33. package/common/utils/getMapGlCopyrights.js +3 -3
  34. package/common/utils/getRealtimeModeSuffix.d.ts +1 -0
  35. package/common/utils/getRealtimeModeSuffix.js +1 -0
  36. package/common/utils/getVehiclePosition.d.ts +5 -4
  37. package/common/utils/getVehiclePosition.js +6 -3
  38. package/common/utils/realtimeConfig.d.ts +1 -1
  39. package/common/utils/realtimeConfig.js +0 -1
  40. package/common/utils/renderTrajectories.d.ts +2 -1
  41. package/common/utils/renderTrajectories.js +7 -6
  42. package/common/utils/sortAndFilterDepartures.d.ts +2 -1
  43. package/common/utils/sortAndFilterDepartures.js +2 -1
  44. package/common/utils/sortByDelay.d.ts +2 -2
  45. package/common/utils/sortByDelay.js +5 -1
  46. package/maplibre/controls/CopyrightControl.d.ts +9 -6
  47. package/maplibre/controls/CopyrightControl.js +11 -8
  48. package/maplibre/layers/Layer.d.ts +8 -7
  49. package/maplibre/layers/Layer.js +2 -3
  50. package/maplibre/layers/RealtimeLayer.d.ts +82 -118
  51. package/maplibre/layers/RealtimeLayer.js +154 -118
  52. package/maplibre/utils/getSourceCoordinates.d.ts +1 -0
  53. package/maplibre/utils/getSourceCoordinates.js +6 -5
  54. package/mbt.js +14611 -14591
  55. package/mbt.js.map +4 -4
  56. package/mbt.min.js +75 -75
  57. package/mbt.min.js.map +4 -4
  58. package/ol/controls/CopyrightControl.d.ts +13 -5
  59. package/ol/controls/CopyrightControl.js +13 -5
  60. package/ol/controls/RoutingControl.d.ts +105 -101
  61. package/ol/controls/RoutingControl.js +250 -264
  62. package/ol/controls/StopFinderControl.d.ts +24 -5
  63. package/ol/controls/StopFinderControl.js +24 -5
  64. package/ol/layers/Layer.d.ts +26 -0
  65. package/ol/layers/Layer.js +39 -0
  66. package/ol/layers/MaplibreLayer.d.ts +56 -28
  67. package/ol/layers/MaplibreLayer.js +154 -31
  68. package/ol/layers/MaplibreStyleLayer.d.ts +71 -149
  69. package/ol/layers/MaplibreStyleLayer.js +281 -210
  70. package/ol/layers/RealtimeLayer.d.ts +95 -230
  71. package/ol/layers/RealtimeLayer.js +209 -211
  72. package/ol/layers/VectorLayer.d.ts +17 -0
  73. package/ol/layers/VectorLayer.js +33 -0
  74. package/ol/layers/index.d.ts +2 -0
  75. package/ol/layers/index.js +3 -0
  76. package/ol/renderers/MaplibreLayerRenderer.d.ts +0 -20
  77. package/ol/renderers/MaplibreLayerRenderer.js +142 -114
  78. package/ol/renderers/MaplibreStyleLayerRenderer.d.ts +6 -6
  79. package/ol/renderers/MaplibreStyleLayerRenderer.js +20 -23
  80. package/ol/renderers/RealtimeLayerRenderer.d.ts +7 -7
  81. package/ol/renderers/RealtimeLayerRenderer.js +46 -66
  82. package/ol/styles/fullTrajectoryDelayStyle.js +5 -7
  83. package/ol/styles/fullTrajectoryStyle.d.ts +1 -2
  84. package/ol/styles/fullTrajectoryStyle.js +5 -7
  85. package/ol/styles/routingStyle.d.ts +0 -1
  86. package/ol/styles/routingStyle.js +13 -10
  87. package/ol/utils/defineDeprecatedProperties.d.ts +10 -0
  88. package/ol/utils/defineDeprecatedProperties.js +180 -0
  89. package/ol/utils/getFeatureInfoAtCoordinate.d.ts +1 -1
  90. package/ol/utils/getFeatureInfoAtCoordinate.js +11 -17
  91. package/package.json +44 -44
  92. package/setupTests.js +17 -4
  93. package/types/common.d.ts +53 -69
  94. package/types/index.d.ts +1 -1
  95. package/types/realtime.d.ts +98 -95
  96. package/types/routing.d.ts +60 -60
  97. package/types/stops.d.ts +62 -62
  98. package/common/mixins/RealtimeLayerMixin.d.ts +0 -273
  99. package/common/mixins/RealtimeLayerMixin.js +0 -743
  100. package/ol/layers/MapGlLayer.d.ts +0 -144
  101. package/ol/layers/MapGlLayer.js +0 -144
  102. package/ol/mixins/MobilityLayerMixin.d.ts +0 -98
  103. package/ol/mixins/MobilityLayerMixin.js +0 -6
  104. package/ol/mixins/PropertiesLayerMixin.d.ts +0 -127
  105. package/ol/mixins/PropertiesLayerMixin.js +0 -143
@@ -1,36 +1,46 @@
1
- import HttpAPI from './HttpAPI';
2
1
  import { RoutingParameters, RoutingResponse } from '../types';
3
- export type RoutingAPIOptions = {
4
- url?: string;
2
+ import HttpAPI from './HttpAPI';
3
+ export interface RoutingAPIOptions {
5
4
  apiKey?: string;
6
- };
5
+ url?: string;
6
+ }
7
7
  /**
8
- * Access to the [geOps Routing API](https://developer.geops.io/apis/routing).
8
+ * This class provides convenience methods to use to the [geOps Routing API](https://developer.geops.io/apis/routing).
9
9
  *
10
10
  * @example
11
11
  * import { RoutingAPI } from 'mobility-toolbox-js';
12
12
  *
13
13
  * const api = new RoutingAPI({
14
- * apiKey: [yourApiKey]
14
+ * apiKey: [yourApiKey],
15
+ * // url: 'https://api.geops.io/routing/v1/',
15
16
  * });
16
17
  *
18
+ * const route = await api.route({
19
+ * via: "freiburg|basel%20sbb|bern",
20
+ * mot: "rail"
21
+ * });
22
+ *
23
+ * console.log('Log route:', JSON.stringify(route));
24
+ *
17
25
  * @public
18
26
  */
19
27
  declare class RoutingAPI extends HttpAPI {
20
28
  /**
21
29
  * Constructor
22
30
  *
23
- * @param {RoutingAPIOptions} options Options.
24
- * @param {string} [options.url='https://api.geops.io/routing/v1/'] Service url.
31
+ * @param {Object} options Options.
25
32
  * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
33
+ * @param {string} [options.url='https://api.geops.io/routing/v1/'] Service url.
34
+ * @public
26
35
  */
27
36
  constructor(options?: RoutingAPIOptions);
28
37
  /**
29
- * Route.
38
+ * Calculate a route.
30
39
  *
31
- * @param {RoutingParameters} params Request parameters. See [Routing service documentation](https://developer.geops.io/apis/routing/).
32
- * @param {RequestInit} config Options for the fetch request.
40
+ * @param {RoutingParameters} params Request parameters. See [geOps Routing API](https://developer.geops.io/apis/routing/).
41
+ * @param {FetchOptions} config Options for the fetch request.
33
42
  * @return {Promise<RoutingResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
43
+ * @public
34
44
  */
35
45
  route(params: RoutingParameters, config: RequestInit): Promise<RoutingResponse>;
36
46
  }
package/api/RoutingAPI.js CHANGED
@@ -1,33 +1,43 @@
1
1
  import HttpAPI from './HttpAPI';
2
2
  /**
3
- * Access to the [geOps Routing API](https://developer.geops.io/apis/routing).
3
+ * This class provides convenience methods to use to the [geOps Routing API](https://developer.geops.io/apis/routing).
4
4
  *
5
5
  * @example
6
6
  * import { RoutingAPI } from 'mobility-toolbox-js';
7
7
  *
8
8
  * const api = new RoutingAPI({
9
- * apiKey: [yourApiKey]
9
+ * apiKey: [yourApiKey],
10
+ * // url: 'https://api.geops.io/routing/v1/',
10
11
  * });
11
12
  *
13
+ * const route = await api.route({
14
+ * via: "freiburg|basel%20sbb|bern",
15
+ * mot: "rail"
16
+ * });
17
+ *
18
+ * console.log('Log route:', JSON.stringify(route));
19
+ *
12
20
  * @public
13
21
  */
14
22
  class RoutingAPI extends HttpAPI {
15
23
  /**
16
24
  * Constructor
17
25
  *
18
- * @param {RoutingAPIOptions} options Options.
19
- * @param {string} [options.url='https://api.geops.io/routing/v1/'] Service url.
26
+ * @param {Object} options Options.
20
27
  * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
28
+ * @param {string} [options.url='https://api.geops.io/routing/v1/'] Service url.
29
+ * @public
21
30
  */
22
31
  constructor(options = {}) {
23
32
  super(Object.assign({ url: 'https://api.geops.io/routing/v1/' }, options));
24
33
  }
25
34
  /**
26
- * Route.
35
+ * Calculate a route.
27
36
  *
28
- * @param {RoutingParameters} params Request parameters. See [Routing service documentation](https://developer.geops.io/apis/routing/).
29
- * @param {RequestInit} config Options for the fetch request.
37
+ * @param {RoutingParameters} params Request parameters. See [geOps Routing API](https://developer.geops.io/apis/routing/).
38
+ * @param {FetchOptions} config Options for the fetch request.
30
39
  * @return {Promise<RoutingResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
40
+ * @public
31
41
  */
32
42
  route(params, config) {
33
43
  return this.fetch('', params, config);
package/api/StopsAPI.d.ts CHANGED
@@ -1,37 +1,43 @@
1
- import HttpAPI from './HttpAPI';
2
1
  import { StopsParameters, StopsResponse } from '../types';
3
- export type StopsAPIOptions = {
4
- url?: string;
2
+ import HttpAPI from './HttpAPI';
3
+ export interface StopsAPIOptions {
5
4
  apiKey?: string;
6
- };
5
+ url?: string;
6
+ }
7
7
  /**
8
- * Access to the [geOps Stops api](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
8
+ * This class provides convenience methods to use to the [geOps Stops API](https://developer.geops.io/apis/stops/).
9
9
  *
10
10
  * @example
11
11
  * import { StopsAPI } from 'mobility-toolbox-js/api';
12
12
  *
13
13
  * const api = new StopsAPI({
14
- * url: 'https://api.geops.io/stops/v1/',
15
- * apiKey: [yourApiKey]
14
+ * apiKey: [yourApiKey],
15
+ * // url: 'https://api.geops.io/stops/v1/',
16
16
  * });
17
17
  *
18
+ * const stops = await api.search({ q:"Bern" });
19
+ *
20
+ * console.log('Log stops:', JSON.stringify(stops));
21
+ *
18
22
  * @public
19
23
  */
20
24
  declare class StopsAPI extends HttpAPI {
21
25
  /**
22
26
  * Constructor
23
27
  *
24
- * @param {StopsAPIOptions} options Options.
25
- * @param {string} [options.url='https://api.geops.io/stops/v1/'] Service url.
26
- * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
28
+ * @param {Object} options Options.
29
+ * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
30
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] Url of the [geOps stops API](https://developer.geops.io/apis/stops/).
31
+ * @public
27
32
  */
28
33
  constructor(options?: StopsAPIOptions);
29
34
  /**
30
- * Search fo stops.
35
+ * Search for stops.
31
36
  *
32
- * @param {StopsParameters} params Request parameters. See [Stops service documentation](https://developer.geops.io/apis/stops).
33
- * @param {RequestInit} config Options for the fetch request.
34
- * @return {Promise<StopsResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
37
+ * @param {StopsParameters} params Request parameters. See [Stops API documentation](https://developer.geops.io/apis/stops).
38
+ * @param {FetchOptions} config Options for the fetch request.
39
+ * @returns {Promise<StopsResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326). See [Stops API documentation](https://developer.geops.io/apis/stops).
40
+ * @public
35
41
  */
36
42
  search(params: StopsParameters, config: RequestInit): Promise<StopsResponse>;
37
43
  }
package/api/StopsAPI.js CHANGED
@@ -1,34 +1,40 @@
1
1
  import HttpAPI from './HttpAPI';
2
2
  /**
3
- * Access to the [geOps Stops api](https://developer.geops.io/apis/5dcbd702a256d90001cf1361/).
3
+ * This class provides convenience methods to use to the [geOps Stops API](https://developer.geops.io/apis/stops/).
4
4
  *
5
5
  * @example
6
6
  * import { StopsAPI } from 'mobility-toolbox-js/api';
7
7
  *
8
8
  * const api = new StopsAPI({
9
- * url: 'https://api.geops.io/stops/v1/',
10
- * apiKey: [yourApiKey]
9
+ * apiKey: [yourApiKey],
10
+ * // url: 'https://api.geops.io/stops/v1/',
11
11
  * });
12
12
  *
13
+ * const stops = await api.search({ q:"Bern" });
14
+ *
15
+ * console.log('Log stops:', JSON.stringify(stops));
16
+ *
13
17
  * @public
14
18
  */
15
19
  class StopsAPI extends HttpAPI {
16
20
  /**
17
21
  * Constructor
18
22
  *
19
- * @param {StopsAPIOptions} options Options.
20
- * @param {string} [options.url='https://api.geops.io/stops/v1/'] Service url.
21
- * @param {string} options.apiKey Access key for [geOps services](https://developer.geops.io/).
23
+ * @param {Object} options Options.
24
+ * @param {string} options.apiKey Access key for [geOps apis](https://developer.geops.io/).
25
+ * @param {string} [options.url='https://api.geops.io/stops/v1/'] Url of the [geOps stops API](https://developer.geops.io/apis/stops/).
26
+ * @public
22
27
  */
23
28
  constructor(options = {}) {
24
- super(Object.assign({ url: 'https://api.geops.io/stops/v1/' }, options));
29
+ super(Object.assign(Object.assign({}, options), { url: options.url || 'https://api.geops.io/stops/v1/' }));
25
30
  }
26
31
  /**
27
- * Search fo stops.
32
+ * Search for stops.
28
33
  *
29
- * @param {StopsParameters} params Request parameters. See [Stops service documentation](https://developer.geops.io/apis/stops).
30
- * @param {RequestInit} config Options for the fetch request.
31
- * @return {Promise<StopsResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326).
34
+ * @param {StopsParameters} params Request parameters. See [Stops API documentation](https://developer.geops.io/apis/stops).
35
+ * @param {FetchOptions} config Options for the fetch request.
36
+ * @returns {Promise<StopsResponse>} An GeoJSON feature collection with coordinates in [EPSG:4326](http://epsg.io/4326). See [Stops API documentation](https://developer.geops.io/apis/stops).
37
+ * @public
32
38
  */
33
39
  search(params, config) {
34
40
  return this.fetch('', params, config);
@@ -1,49 +1,43 @@
1
1
  import { RealtimeTrajectoryResponse } from '../types';
2
- export declare type WebSocketAPIParameters = {
2
+ export declare interface WebSocketAPIParameters {
3
+ args?: number | string;
3
4
  channel?: string;
4
- args?: string | number;
5
- id?: string | number;
6
- };
7
- export declare type WebSocketAPIMessageEventData<T> = {
8
- timestamp: number;
9
- source: string;
5
+ id?: number | string;
6
+ }
7
+ export declare interface WebSocketAPIMessageEventData<T> {
8
+ client_reference: null | number | string;
10
9
  content: T;
11
- client_reference: string | number | null;
12
- };
13
- export type WebSocketAPIBufferMessageEventData = WebSocketAPIMessageEventData<RealtimeTrajectoryResponse[]> & {
10
+ source: string;
11
+ timestamp: number;
12
+ }
13
+ export type WebSocketAPIBufferMessageEventData = {
14
14
  source: 'buffer';
15
- };
16
- export type WebSocketAPIMessageEvent = Event & {
15
+ } & WebSocketAPIMessageEventData<RealtimeTrajectoryResponse[]>;
16
+ export type WebSocketAPIMessageEvent = {
17
17
  data: string;
18
- };
19
- export interface WebSocketAPIMessageEventListener {
20
- (evt: WebSocketAPIMessageEvent): void;
21
- }
18
+ } & Event;
19
+ export type WebSocketAPIMessageEventListener = (evt: WebSocketAPIMessageEvent) => void;
22
20
  /**
23
21
  * This type represents a function that has been call with each feature returned by the websocket.
24
22
  */
25
- export interface WebSocketAPIMessageCallback<T> {
26
- (data: WebSocketAPIMessageEventData<T>): void;
27
- }
28
- export declare type WebSocketAPISubscription = {
29
- params: WebSocketAPIParameters;
23
+ export type WebSocketAPIMessageCallback<T> = (data: WebSocketAPIMessageEventData<T>) => void;
24
+ export declare interface WebSocketAPISubscription {
30
25
  cb: WebSocketAPIMessageCallback<any>;
31
26
  errorCb?: EventListener;
32
- onMessageCb: WebSocketAPIMessageEventListener;
33
27
  onErrorCb?: EventListener;
34
- quiet: boolean;
35
- };
36
- export declare type WebSocketAPISubscribed = {
37
- [index: string]: boolean;
38
- };
39
- export declare type WebSocketAPIRequest = {
28
+ onMessageCb: WebSocketAPIMessageEventListener;
40
29
  params: WebSocketAPIParameters;
30
+ quiet: boolean;
31
+ }
32
+ export type WebSocketAPISubscribed = Record<string, boolean>;
33
+ export declare interface WebSocketAPIRequest {
41
34
  cb: WebSocketAPIMessageCallback<any>;
42
35
  errorCb?: EventListener;
43
- onMessageCb: WebSocketAPIMessageEventListener;
44
36
  onErrorCb?: EventListener;
45
- requestString: String;
46
- };
37
+ onMessageCb: WebSocketAPIMessageEventListener;
38
+ params: WebSocketAPIParameters;
39
+ requestString: string;
40
+ }
47
41
  /**
48
42
  * Class used to facilitate connection to a WebSocketAPI and
49
43
  * also to manage properly messages send to the WebSocketAPI.
@@ -51,17 +45,16 @@ export declare type WebSocketAPIRequest = {
51
45
  * @private
52
46
  */
53
47
  declare class WebSocketAPI {
54
- websocket?: WebSocket;
55
48
  closed?: boolean;
56
49
  closing?: boolean;
57
50
  connecting?: boolean;
51
+ messagesOnOpen: string[];
58
52
  open?: boolean;
59
- messagesOnOpen: Array<string>;
60
- subscriptions: Array<WebSocketAPISubscription>;
53
+ requests: WebSocketAPIRequest[];
61
54
  subscribed: WebSocketAPISubscribed;
62
- requests: Array<WebSocketAPIRequest>;
55
+ subscriptions: WebSocketAPISubscription[];
56
+ websocket?: WebSocket;
63
57
  constructor();
64
- defineProperties(): void;
65
58
  /**
66
59
  * Get the websocket request string.
67
60
  *
@@ -74,29 +67,32 @@ declare class WebSocketAPI {
74
67
  * @private
75
68
  */
76
69
  static getRequestString(method: string, params?: WebSocketAPIParameters): string;
70
+ addEvents(onMessage: WebSocketAPIMessageEventListener, onError?: EventListener): void;
77
71
  /**
78
- * (Re)connect the websocket.
72
+ * Close the websocket definitively.
79
73
  *
80
- * @param {string} url Websocket url.
81
- * @param {function} onOpen Callback called when the websocket connection is opened and before subscriptions of previous subscriptions.
82
74
  * @private
83
75
  */
84
- connect(url: string, onOpen?: () => void): void;
76
+ close(): void;
85
77
  /**
86
- * Close the websocket definitively.
78
+ * (Re)connect the websocket.
87
79
  *
80
+ * @param {string} url Websocket url.
81
+ * @param {function} onOpen Callback called when the websocket connection is opened and before subscriptions of previous subscriptions.
88
82
  * @private
89
83
  */
90
- close(): void;
84
+ connect(url: string, onOpen?: () => void): void;
85
+ defineProperties(): void;
91
86
  /**
92
- * Sends a message to the websocket.
87
+ * Sends a get request to the websocket.
88
+ * The callback is called only once, when the response is received or when the call returns an error.
93
89
  *
94
- * @param {message} message Message to send.
90
+ * @param {Object} params Parameters for the websocket get request
91
+ * @param {function} cb callback on message event
92
+ * @param {function} errorCb Callback on error and close event
95
93
  * @private
96
94
  */
97
- send(message: string): void;
98
- addEvents(onMessage: WebSocketAPIMessageEventListener, onError?: EventListener): void;
99
- removeEvents(onMessage: WebSocketAPIMessageEventListener, onError?: EventListener): void;
95
+ get(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>, errorCb?: EventListener): void;
100
96
  /**
101
97
  * Listen to websocket messages.
102
98
  *
@@ -107,27 +103,17 @@ declare class WebSocketAPI {
107
103
  * @private
108
104
  */
109
105
  listen(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>, errorCb?: EventListener): {
110
- onMessageCb: WebSocketAPIMessageEventListener;
111
106
  onErrorCb?: EventListener;
107
+ onMessageCb: WebSocketAPIMessageEventListener;
112
108
  };
109
+ removeEvents(onMessage: WebSocketAPIMessageEventListener, onError?: EventListener): void;
113
110
  /**
114
- * Unlisten websocket messages.
115
- *
116
- * @param {Object} params Parameters for the websocket get request.
117
- * @param {function} cb Callback used when listen.
118
- * @private
119
- */
120
- unlisten(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>): void;
121
- /**
122
- * Sends a get request to the websocket.
123
- * The callback is called only once, when the response is received or when the call returns an error.
111
+ * Sends a message to the websocket.
124
112
  *
125
- * @param {Object} params Parameters for the websocket get request
126
- * @param {function} onMessage callback on message event
127
- * @param {function} onError Callback on error and close event
113
+ * @param {message} message Message to send.
128
114
  * @private
129
115
  */
130
- get(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>, errorCb?: EventListener): void;
116
+ send(message: string): void;
131
117
  /**
132
118
  * Subscribe to a given channel.
133
119
  *
@@ -138,6 +124,18 @@ declare class WebSocketAPI {
138
124
  * @private
139
125
  */
140
126
  subscribe(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>, errorCb?: EventListener, quiet?: boolean): void;
127
+ /**
128
+ * After an auto reconnection we need to re-subscribe to the channels.
129
+ */
130
+ subscribePreviousSubscriptions(): void;
131
+ /**
132
+ * Unlisten websocket messages.
133
+ *
134
+ * @param {Object} params Parameters for the websocket get request.
135
+ * @param {function} cb Callback used when listen.
136
+ * @private
137
+ */
138
+ unlisten(params: WebSocketAPIParameters, cb: WebSocketAPIMessageCallback<any>): void;
141
139
  /**
142
140
  * Unsubscribe from a channel.
143
141
  * @param {string} source source to unsubscribe from
@@ -145,9 +143,5 @@ declare class WebSocketAPI {
145
143
  * @private
146
144
  */
147
145
  unsubscribe(source: string, cb?: WebSocketAPIMessageCallback<any>): void;
148
- /**
149
- * After an auto reconnection we need to re-subscribe to the channels.
150
- */
151
- subscribePreviousSubscriptions(): void;
152
146
  }
153
147
  export default WebSocketAPI;