@ngxs/websocket-plugin 3.7.6 → 3.8.0-dev.master-743a236

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.
@@ -1,644 +0,0 @@
1
- import { __extends, __assign } from 'tslib';
2
- import { InjectionToken, Injectable, Inject, APP_INITIALIZER, NgModule } from '@angular/core';
3
- import { ofActionDispatched, getValue, Store, Actions } from '@ngxs/store';
4
- import { Subscription } from 'rxjs';
5
- import { WebSocketSubject } from 'rxjs/webSocket';
6
-
7
- /**
8
- * @fileoverview added by tsickle
9
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
10
- */
11
- /** @type {?} */
12
- var NGXS_WEBSOCKET_OPTIONS = new InjectionToken('NGXS_WEBSOCKET_OPTIONS');
13
- /**
14
- * @record
15
- */
16
- function NgxsWebsocketPluginOptions() { }
17
- if (false) {
18
- /**
19
- * URL of the websocket.
20
- * @type {?|undefined}
21
- */
22
- NgxsWebsocketPluginOptions.prototype.url;
23
- /**
24
- * Either a single protocol string or an array of protocol strings.
25
- * These strings are used to indicate sub-protocols, so that a single server
26
- * can implement multiple WebSocket sub-protocols (for example, you might want one server to be able
27
- * to handle different types of interactions depending on the specified protocol).
28
- * If you don't specify a protocol string, an empty string is assumed.
29
- * @type {?|undefined}
30
- */
31
- NgxsWebsocketPluginOptions.prototype.protocol;
32
- /**
33
- * Sets the `binaryType` property of the underlying WebSocket.
34
- * @type {?|undefined}
35
- */
36
- NgxsWebsocketPluginOptions.prototype.binaryType;
37
- /**
38
- * The property name to distigunish this type for the store.
39
- * Default: 'type'
40
- * @type {?|undefined}
41
- */
42
- NgxsWebsocketPluginOptions.prototype.typeKey;
43
- /**
44
- * Interval to try and reconnect.
45
- * Default: 5000
46
- * @type {?|undefined}
47
- */
48
- NgxsWebsocketPluginOptions.prototype.reconnectInterval;
49
- /**
50
- * Number of reconnect attemps.
51
- * Default: 10
52
- * @type {?|undefined}
53
- */
54
- NgxsWebsocketPluginOptions.prototype.reconnectAttempts;
55
- /**
56
- * Serializer to call before sending messages
57
- * Default: `json.stringify`
58
- * @type {?|undefined}
59
- */
60
- NgxsWebsocketPluginOptions.prototype.serializer;
61
- /**
62
- * Deseralizer before publishing the message.
63
- * @type {?|undefined}
64
- */
65
- NgxsWebsocketPluginOptions.prototype.deserializer;
66
- }
67
- /**
68
- * @param {...?} _args
69
- * @return {?}
70
- */
71
- function noop() {
72
- var _args = [];
73
- for (var _i = 0; _i < arguments.length; _i++) {
74
- _args[_i] = arguments[_i];
75
- }
76
- return (/**
77
- * @return {?}
78
- */
79
- function () { });
80
- }
81
- /**
82
- * Action to connect to the websocket. Optionally pass a URL.
83
- */
84
- var /**
85
- * Action to connect to the websocket. Optionally pass a URL.
86
- */
87
- ConnectWebSocket = /** @class */ (function () {
88
- function ConnectWebSocket(payload) {
89
- this.payload = payload;
90
- }
91
- Object.defineProperty(ConnectWebSocket, "type", {
92
- get: /**
93
- * @return {?}
94
- */
95
- function () {
96
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
97
- return '[WebSocket] Connect';
98
- },
99
- enumerable: true,
100
- configurable: true
101
- });
102
- return ConnectWebSocket;
103
- }());
104
- if (false) {
105
- /** @type {?} */
106
- ConnectWebSocket.prototype.payload;
107
- }
108
- /**
109
- * Action triggered when a error ocurrs
110
- */
111
- var /**
112
- * Action triggered when a error ocurrs
113
- */
114
- WebsocketMessageError = /** @class */ (function () {
115
- function WebsocketMessageError(payload) {
116
- this.payload = payload;
117
- }
118
- Object.defineProperty(WebsocketMessageError, "type", {
119
- get: /**
120
- * @return {?}
121
- */
122
- function () {
123
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
124
- return '[WebSocket] Message Error';
125
- },
126
- enumerable: true,
127
- configurable: true
128
- });
129
- return WebsocketMessageError;
130
- }());
131
- if (false) {
132
- /** @type {?} */
133
- WebsocketMessageError.prototype.payload;
134
- }
135
- /**
136
- * Action to disconnect the websocket.
137
- */
138
- var /**
139
- * Action to disconnect the websocket.
140
- */
141
- DisconnectWebSocket = /** @class */ (function () {
142
- function DisconnectWebSocket() {
143
- }
144
- Object.defineProperty(DisconnectWebSocket, "type", {
145
- get: /**
146
- * @return {?}
147
- */
148
- function () {
149
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
150
- return '[WebSocket] Disconnect';
151
- },
152
- enumerable: true,
153
- configurable: true
154
- });
155
- return DisconnectWebSocket;
156
- }());
157
- /**
158
- * Action triggered when websocket is connected
159
- */
160
- var /**
161
- * Action triggered when websocket is connected
162
- */
163
- WebSocketConnected = /** @class */ (function () {
164
- function WebSocketConnected() {
165
- }
166
- Object.defineProperty(WebSocketConnected, "type", {
167
- get: /**
168
- * @return {?}
169
- */
170
- function () {
171
- return '[WebSocket] Connected';
172
- },
173
- enumerable: true,
174
- configurable: true
175
- });
176
- return WebSocketConnected;
177
- }());
178
- /**
179
- * Action triggered when websocket is disconnected
180
- */
181
- var /**
182
- * Action triggered when websocket is disconnected
183
- */
184
- WebSocketDisconnected = /** @class */ (function () {
185
- function WebSocketDisconnected() {
186
- }
187
- Object.defineProperty(WebSocketDisconnected, "type", {
188
- get: /**
189
- * @return {?}
190
- */
191
- function () {
192
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
193
- return '[WebSocket] Disconnected';
194
- },
195
- enumerable: true,
196
- configurable: true
197
- });
198
- return WebSocketDisconnected;
199
- }());
200
- /**
201
- * Action to send to the server.
202
- */
203
- var /**
204
- * Action to send to the server.
205
- */
206
- SendWebSocketMessage = /** @class */ (function () {
207
- function SendWebSocketMessage(payload) {
208
- this.payload = payload;
209
- }
210
- Object.defineProperty(SendWebSocketMessage, "type", {
211
- get: /**
212
- * @return {?}
213
- */
214
- function () {
215
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
216
- return '[WebSocket] Send Message';
217
- },
218
- enumerable: true,
219
- configurable: true
220
- });
221
- return SendWebSocketMessage;
222
- }());
223
- if (false) {
224
- /** @type {?} */
225
- SendWebSocketMessage.prototype.payload;
226
- }
227
- /**
228
- * Action dispatched when the user tries to connect if the connection already exists.
229
- */
230
- var /**
231
- * Action dispatched when the user tries to connect if the connection already exists.
232
- */
233
- WebSocketConnectionUpdated = /** @class */ (function () {
234
- function WebSocketConnectionUpdated() {
235
- }
236
- Object.defineProperty(WebSocketConnectionUpdated, "type", {
237
- get: /**
238
- * @return {?}
239
- */
240
- function () {
241
- // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138
242
- return '[WebSocket] Connection Updated';
243
- },
244
- enumerable: true,
245
- configurable: true
246
- });
247
- return WebSocketConnectionUpdated;
248
- }());
249
- /**
250
- * This error is thrown where there is no `type` (or custom `typeKey`) property
251
- * on the message that came from the server side socket
252
- */
253
- var /**
254
- * This error is thrown where there is no `type` (or custom `typeKey`) property
255
- * on the message that came from the server side socket
256
- */
257
- TypeKeyPropertyMissingError = /** @class */ (function (_super) {
258
- __extends(TypeKeyPropertyMissingError, _super);
259
- function TypeKeyPropertyMissingError(typeKey) {
260
- return _super.call(this, "Property " + typeKey + " is missing on the socket message") || this;
261
- }
262
- return TypeKeyPropertyMissingError;
263
- }(Error));
264
-
265
- /**
266
- * @fileoverview added by tsickle
267
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
268
- */
269
- var WebSocketHandler = /** @class */ (function () {
270
- function WebSocketHandler(store, actions$, options) {
271
- var _this = this;
272
- this.store = store;
273
- this.actions$ = actions$;
274
- this.options = options;
275
- this.socket = null;
276
- this.config = {
277
- url: (/** @type {?} */ (this.options.url)),
278
- protocol: this.options.protocol,
279
- // Default binary type is `blob` for the global `WebSocket`
280
- binaryType: this.options.binaryType,
281
- serializer: this.options.serializer,
282
- deserializer: this.options.deserializer,
283
- closeObserver: {
284
- next: (/**
285
- * @return {?}
286
- */
287
- function () {
288
- // ATTENTION!
289
- // See https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/dom/WebSocketSubject.ts#L340
290
- // RxJS socket emits `onComplete` event only if `event.wasClean` is truthy
291
- // and doesn't complete socket subject if it's falsy
292
- _this.disconnect();
293
- })
294
- },
295
- openObserver: {
296
- next: (/**
297
- * @return {?}
298
- */
299
- function () { return _this.store.dispatch(new WebSocketConnected()); })
300
- }
301
- };
302
- this.typeKey = (/** @type {?} */ (this.options.typeKey));
303
- this.subscription = new Subscription();
304
- this.setupActionsListeners();
305
- }
306
- /**
307
- * @return {?}
308
- */
309
- WebSocketHandler.prototype.ngOnDestroy = /**
310
- * @return {?}
311
- */
312
- function () {
313
- this.closeConnection();
314
- this.subscription.unsubscribe();
315
- };
316
- /**
317
- * @private
318
- * @return {?}
319
- */
320
- WebSocketHandler.prototype.setupActionsListeners = /**
321
- * @private
322
- * @return {?}
323
- */
324
- function () {
325
- var _this = this;
326
- this.subscription.add(this.actions$.pipe(ofActionDispatched(ConnectWebSocket)).subscribe((/**
327
- * @param {?} __0
328
- * @return {?}
329
- */
330
- function (_a) {
331
- var payload = _a.payload;
332
- _this.connect(payload);
333
- })));
334
- this.subscription.add(this.actions$.pipe(ofActionDispatched(DisconnectWebSocket)).subscribe((/**
335
- * @return {?}
336
- */
337
- function () {
338
- _this.disconnect();
339
- })));
340
- this.subscription.add(this.actions$.pipe(ofActionDispatched(SendWebSocketMessage)).subscribe((/**
341
- * @param {?} __0
342
- * @return {?}
343
- */
344
- function (_a) {
345
- var payload = _a.payload;
346
- _this.send(payload);
347
- })));
348
- };
349
- /**
350
- * @private
351
- * @param {?=} options
352
- * @return {?}
353
- */
354
- WebSocketHandler.prototype.connect = /**
355
- * @private
356
- * @param {?=} options
357
- * @return {?}
358
- */
359
- function (options) {
360
- var _this = this;
361
- this.updateConnection();
362
- // Users can pass the options in the connect method so
363
- // if options aren't available at DI bootstrap they have access
364
- // to pass them here
365
- if (options) {
366
- this.mergeConfigWithOptions(options);
367
- }
368
- this.socket = new WebSocketSubject(this.config);
369
- this.socket.subscribe({
370
- next: (/**
371
- * @param {?} message
372
- * @return {?}
373
- */
374
- function (message) {
375
- /** @type {?} */
376
- var type = getValue(message, _this.typeKey);
377
- if (!type) {
378
- throw new TypeKeyPropertyMissingError(_this.typeKey);
379
- }
380
- _this.store.dispatch(__assign({}, message, { type: type }));
381
- }),
382
- error: (/**
383
- * @param {?} error
384
- * @return {?}
385
- */
386
- function (error) {
387
- if (error instanceof CloseEvent) {
388
- _this.dispatchWebSocketDisconnected();
389
- }
390
- else {
391
- _this.store.dispatch(new WebsocketMessageError(error));
392
- }
393
- })
394
- });
395
- };
396
- /**
397
- * @private
398
- * @return {?}
399
- */
400
- WebSocketHandler.prototype.disconnect = /**
401
- * @private
402
- * @return {?}
403
- */
404
- function () {
405
- if (this.socket) {
406
- this.closeConnection();
407
- this.dispatchWebSocketDisconnected();
408
- }
409
- };
410
- /**
411
- * @private
412
- * @param {?} data
413
- * @return {?}
414
- */
415
- WebSocketHandler.prototype.send = /**
416
- * @private
417
- * @param {?} data
418
- * @return {?}
419
- */
420
- function (data) {
421
- if (!this.socket) {
422
- throw new Error('You must connect to the socket before sending any data');
423
- }
424
- this.socket.next(data);
425
- };
426
- /**
427
- * Don't enlarge the `connect` method
428
- */
429
- /**
430
- * Don't enlarge the `connect` method
431
- * @private
432
- * @param {?} options
433
- * @return {?}
434
- */
435
- WebSocketHandler.prototype.mergeConfigWithOptions = /**
436
- * Don't enlarge the `connect` method
437
- * @private
438
- * @param {?} options
439
- * @return {?}
440
- */
441
- function (options) {
442
- if (options.url) {
443
- this.config.url = options.url;
444
- }
445
- if (options.serializer) {
446
- this.config.serializer = options.serializer;
447
- }
448
- if (options.deserializer) {
449
- this.config.deserializer = options.deserializer;
450
- }
451
- };
452
- /**
453
- * To ensure we don't have any memory leaks
454
- * e.g. if the user occasionally dispatched `ConnectWebSocket` twice
455
- * then the previous subscription will still live in the memory
456
- * to prevent such behavior - we close the previous connection if it exists
457
- */
458
- /**
459
- * To ensure we don't have any memory leaks
460
- * e.g. if the user occasionally dispatched `ConnectWebSocket` twice
461
- * then the previous subscription will still live in the memory
462
- * to prevent such behavior - we close the previous connection if it exists
463
- * @private
464
- * @return {?}
465
- */
466
- WebSocketHandler.prototype.updateConnection = /**
467
- * To ensure we don't have any memory leaks
468
- * e.g. if the user occasionally dispatched `ConnectWebSocket` twice
469
- * then the previous subscription will still live in the memory
470
- * to prevent such behavior - we close the previous connection if it exists
471
- * @private
472
- * @return {?}
473
- */
474
- function () {
475
- if (this.socket) {
476
- this.closeConnection();
477
- this.store.dispatch(new WebSocketConnectionUpdated());
478
- }
479
- };
480
- /**
481
- * Used in many places so it's better to move the code into function
482
- */
483
- /**
484
- * Used in many places so it's better to move the code into function
485
- * @private
486
- * @return {?}
487
- */
488
- WebSocketHandler.prototype.dispatchWebSocketDisconnected = /**
489
- * Used in many places so it's better to move the code into function
490
- * @private
491
- * @return {?}
492
- */
493
- function () {
494
- this.store.dispatch(new WebSocketDisconnected());
495
- };
496
- /**
497
- * @private
498
- * @return {?}
499
- */
500
- WebSocketHandler.prototype.closeConnection = /**
501
- * @private
502
- * @return {?}
503
- */
504
- function () {
505
- // `socket.complete()` closes the connection
506
- // also it doesn't invoke the `onComplete` callback that we passed
507
- // into `socket.subscribe(...)`
508
- if (this.socket !== null) {
509
- this.socket.complete();
510
- this.socket = null;
511
- }
512
- };
513
- WebSocketHandler.decorators = [
514
- { type: Injectable }
515
- ];
516
- /** @nocollapse */
517
- WebSocketHandler.ctorParameters = function () { return [
518
- { type: Store },
519
- { type: Actions },
520
- { type: undefined, decorators: [{ type: Inject, args: [NGXS_WEBSOCKET_OPTIONS,] }] }
521
- ]; };
522
- return WebSocketHandler;
523
- }());
524
- if (false) {
525
- /**
526
- * @type {?}
527
- * @private
528
- */
529
- WebSocketHandler.prototype.socket;
530
- /**
531
- * @type {?}
532
- * @private
533
- */
534
- WebSocketHandler.prototype.config;
535
- /**
536
- * @type {?}
537
- * @private
538
- */
539
- WebSocketHandler.prototype.typeKey;
540
- /**
541
- * @type {?}
542
- * @private
543
- */
544
- WebSocketHandler.prototype.subscription;
545
- /**
546
- * @type {?}
547
- * @private
548
- */
549
- WebSocketHandler.prototype.store;
550
- /**
551
- * @type {?}
552
- * @private
553
- */
554
- WebSocketHandler.prototype.actions$;
555
- /**
556
- * @type {?}
557
- * @private
558
- */
559
- WebSocketHandler.prototype.options;
560
- }
561
-
562
- /**
563
- * @fileoverview added by tsickle
564
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
565
- */
566
- /**
567
- * @param {?} options
568
- * @return {?}
569
- */
570
- function websocketOptionsFactory(options) {
571
- return __assign({ reconnectInterval: 5000, reconnectAttempts: 10, typeKey: 'type', deserializer: /**
572
- * @param {?} e
573
- * @return {?}
574
- */
575
- function (e) {
576
- return JSON.parse(e.data);
577
- },
578
- serializer: /**
579
- * @param {?} value
580
- * @return {?}
581
- */
582
- function (value) {
583
- return JSON.stringify(value);
584
- } }, options);
585
- }
586
- /** @type {?} */
587
- var USER_OPTIONS = new InjectionToken('USER_OPTIONS');
588
- var NgxsWebsocketPluginModule = /** @class */ (function () {
589
- function NgxsWebsocketPluginModule() {
590
- }
591
- /**
592
- * @param {?=} options
593
- * @return {?}
594
- */
595
- NgxsWebsocketPluginModule.forRoot = /**
596
- * @param {?=} options
597
- * @return {?}
598
- */
599
- function (options) {
600
- return {
601
- ngModule: NgxsWebsocketPluginModule,
602
- providers: [
603
- WebSocketHandler,
604
- {
605
- provide: USER_OPTIONS,
606
- useValue: options
607
- },
608
- {
609
- provide: NGXS_WEBSOCKET_OPTIONS,
610
- useFactory: websocketOptionsFactory,
611
- deps: [USER_OPTIONS]
612
- },
613
- {
614
- provide: APP_INITIALIZER,
615
- useFactory: noop,
616
- deps: [WebSocketHandler],
617
- multi: true
618
- }
619
- ]
620
- };
621
- };
622
- NgxsWebsocketPluginModule.decorators = [
623
- { type: NgModule }
624
- ];
625
- return NgxsWebsocketPluginModule;
626
- }());
627
-
628
- /**
629
- * @fileoverview added by tsickle
630
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
631
- */
632
-
633
- /**
634
- * @fileoverview added by tsickle
635
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
636
- */
637
-
638
- /**
639
- * @fileoverview added by tsickle
640
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
641
- */
642
-
643
- export { ConnectWebSocket, DisconnectWebSocket, NGXS_WEBSOCKET_OPTIONS, NgxsWebsocketPluginModule, SendWebSocketMessage, WebSocketConnected, WebSocketConnectionUpdated, WebSocketDisconnected, WebsocketMessageError, websocketOptionsFactory as ɵa, USER_OPTIONS as ɵb, noop as ɵc, WebSocketHandler as ɵd };
644
- //# sourceMappingURL=ngxs-websocket-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngxs-websocket-plugin.js","sources":["ng://@ngxs/websocket-plugin/src/symbols.ts","ng://@ngxs/websocket-plugin/src/websocket-handler.ts","ng://@ngxs/websocket-plugin/src/websocket.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const NGXS_WEBSOCKET_OPTIONS = new InjectionToken('NGXS_WEBSOCKET_OPTIONS');\n\nexport interface NgxsWebsocketPluginOptions {\n /**\n * URL of the websocket.\n */\n url?: string;\n\n /**\n * Either a single protocol string or an array of protocol strings.\n * These strings are used to indicate sub-protocols, so that a single server\n * can implement multiple WebSocket sub-protocols (for example, you might want one server to be able\n * to handle different types of interactions depending on the specified protocol).\n * If you don't specify a protocol string, an empty string is assumed.\n */\n protocol?: string | string[];\n\n /**\n * Sets the `binaryType` property of the underlying WebSocket.\n */\n binaryType?: 'blob' | 'arraybuffer';\n\n /**\n * The property name to distigunish this type for the store.\n * Default: 'type'\n */\n typeKey?: string;\n\n /**\n * Interval to try and reconnect.\n * Default: 5000\n */\n reconnectInterval?: number;\n\n /**\n * Number of reconnect attemps.\n * Default: 10\n */\n reconnectAttempts?: number;\n\n /**\n * Serializer to call before sending messages\n * Default: `json.stringify`\n */\n serializer?: (data: any) => string;\n\n /**\n * Deseralizer before publishing the message.\n */\n deserializer?: (e: MessageEvent) => any;\n}\n\nexport function noop(..._args: any[]) {\n return function() {};\n}\n\n/**\n * Action to connect to the websocket. Optionally pass a URL.\n */\nexport class ConnectWebSocket {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Connect';\n }\n constructor(public payload?: NgxsWebsocketPluginOptions) {}\n}\n\n/**\n * Action triggered when a error ocurrs\n */\nexport class WebsocketMessageError {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Message Error';\n }\n constructor(public payload: any) {}\n}\n\n/**\n * Action to disconnect the websocket.\n */\nexport class DisconnectWebSocket {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Disconnect';\n }\n}\n\n/**\n * Action triggered when websocket is connected\n */\nexport class WebSocketConnected {\n static get type() {\n return '[WebSocket] Connected';\n }\n}\n\n/**\n * Action triggered when websocket is disconnected\n */\nexport class WebSocketDisconnected {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Disconnected';\n }\n}\n\n/**\n * Action to send to the server.\n */\nexport class SendWebSocketMessage {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Send Message';\n }\n constructor(public payload: any) {}\n}\n\n/**\n * Action dispatched when the user tries to connect if the connection already exists.\n */\nexport class WebSocketConnectionUpdated {\n static get type() {\n // NOTE: Not necessary to declare the type in this way in your code. See https://github.com/ngxs/store/pull/644#issuecomment-436003138\n return '[WebSocket] Connection Updated';\n }\n}\n\n/**\n * This error is thrown where there is no `type` (or custom `typeKey`) property\n * on the message that came from the server side socket\n */\nexport class TypeKeyPropertyMissingError extends Error {\n constructor(typeKey: string) {\n super(`Property ${typeKey} is missing on the socket message`);\n }\n}\n","import { Injectable, Inject, OnDestroy } from '@angular/core';\nimport { Actions, Store, getValue, ofActionDispatched } from '@ngxs/store';\nimport { Subscription } from 'rxjs';\n\nimport { WebSocketSubject, WebSocketSubjectConfig } from 'rxjs/webSocket';\n\nimport {\n ConnectWebSocket,\n DisconnectWebSocket,\n SendWebSocketMessage,\n NGXS_WEBSOCKET_OPTIONS,\n NgxsWebsocketPluginOptions,\n WebsocketMessageError,\n WebSocketDisconnected,\n TypeKeyPropertyMissingError,\n WebSocketConnectionUpdated,\n WebSocketConnected\n} from './symbols';\n\n@Injectable()\nexport class WebSocketHandler implements OnDestroy {\n private socket: WebSocketSubject<any> | null = null;\n\n private config: WebSocketSubjectConfig<any> = {\n url: this.options.url!,\n protocol: this.options.protocol,\n // Default binary type is `blob` for the global `WebSocket`\n binaryType: this.options.binaryType,\n serializer: this.options.serializer,\n deserializer: this.options.deserializer,\n closeObserver: {\n next: () => {\n // ATTENTION!\n // See https://github.com/ReactiveX/rxjs/blob/master/src/internal/observable/dom/WebSocketSubject.ts#L340\n // RxJS socket emits `onComplete` event only if `event.wasClean` is truthy\n // and doesn't complete socket subject if it's falsy\n this.disconnect();\n }\n },\n openObserver: {\n next: () => this.store.dispatch(new WebSocketConnected())\n }\n };\n\n private typeKey = this.options.typeKey!;\n\n private subscription = new Subscription();\n\n constructor(\n private store: Store,\n private actions$: Actions,\n @Inject(NGXS_WEBSOCKET_OPTIONS) private options: NgxsWebsocketPluginOptions\n ) {\n this.setupActionsListeners();\n }\n\n ngOnDestroy(): void {\n this.closeConnection();\n this.subscription.unsubscribe();\n }\n\n private setupActionsListeners(): void {\n this.subscription.add(\n this.actions$.pipe(ofActionDispatched(ConnectWebSocket)).subscribe(({ payload }) => {\n this.connect(payload);\n })\n );\n\n this.subscription.add(\n this.actions$.pipe(ofActionDispatched(DisconnectWebSocket)).subscribe(() => {\n this.disconnect();\n })\n );\n\n this.subscription.add(\n this.actions$.pipe(ofActionDispatched(SendWebSocketMessage)).subscribe(({ payload }) => {\n this.send(payload);\n })\n );\n }\n\n private connect(options?: NgxsWebsocketPluginOptions): void {\n this.updateConnection();\n\n // Users can pass the options in the connect method so\n // if options aren't available at DI bootstrap they have access\n // to pass them here\n if (options) {\n this.mergeConfigWithOptions(options);\n }\n\n this.socket = new WebSocketSubject(this.config);\n\n this.socket.subscribe({\n next: (message: any) => {\n const type = getValue(message, this.typeKey);\n if (!type) {\n throw new TypeKeyPropertyMissingError(this.typeKey);\n }\n this.store.dispatch({ ...message, type });\n },\n error: (error: any) => {\n if (error instanceof CloseEvent) {\n this.dispatchWebSocketDisconnected();\n } else {\n this.store.dispatch(new WebsocketMessageError(error));\n }\n }\n });\n }\n\n private disconnect(): void {\n if (this.socket) {\n this.closeConnection();\n this.dispatchWebSocketDisconnected();\n }\n }\n\n private send(data: any): void {\n if (!this.socket) {\n throw new Error('You must connect to the socket before sending any data');\n }\n\n this.socket.next(data);\n }\n\n /**\n * Don't enlarge the `connect` method\n */\n private mergeConfigWithOptions(options: NgxsWebsocketPluginOptions): void {\n if (options.url) {\n this.config.url = options.url;\n }\n\n if (options.serializer) {\n this.config.serializer = options.serializer;\n }\n\n if (options.deserializer) {\n this.config.deserializer = options.deserializer;\n }\n }\n\n /**\n * To ensure we don't have any memory leaks\n * e.g. if the user occasionally dispatched `ConnectWebSocket` twice\n * then the previous subscription will still live in the memory\n * to prevent such behavior - we close the previous connection if it exists\n */\n private updateConnection(): void {\n if (this.socket) {\n this.closeConnection();\n this.store.dispatch(new WebSocketConnectionUpdated());\n }\n }\n\n /**\n * Used in many places so it's better to move the code into function\n */\n private dispatchWebSocketDisconnected(): void {\n this.store.dispatch(new WebSocketDisconnected());\n }\n\n private closeConnection(): void {\n // `socket.complete()` closes the connection\n // also it doesn't invoke the `onComplete` callback that we passed\n // into `socket.subscribe(...)`\n if (this.socket !== null) {\n this.socket.complete();\n this.socket = null;\n }\n }\n}\n","import { NgModule, ModuleWithProviders, APP_INITIALIZER, InjectionToken } from '@angular/core';\n\nimport { WebSocketHandler } from './websocket-handler';\nimport { NgxsWebsocketPluginOptions, NGXS_WEBSOCKET_OPTIONS, noop } from './symbols';\n\nexport function websocketOptionsFactory(options: NgxsWebsocketPluginOptions) {\n return {\n reconnectInterval: 5000,\n reconnectAttempts: 10,\n typeKey: 'type',\n deserializer(e: MessageEvent) {\n return JSON.parse(e.data);\n },\n serializer(value: any) {\n return JSON.stringify(value);\n },\n ...options\n };\n}\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsWebsocketPluginModule {\n static forRoot(\n options?: NgxsWebsocketPluginOptions\n ): ModuleWithProviders<NgxsWebsocketPluginModule> {\n return {\n ngModule: NgxsWebsocketPluginModule,\n providers: [\n WebSocketHandler,\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_WEBSOCKET_OPTIONS,\n useFactory: websocketOptionsFactory,\n deps: [USER_OPTIONS]\n },\n {\n provide: APP_INITIALIZER,\n useFactory: noop,\n deps: [WebSocketHandler],\n multi: true\n }\n ]\n };\n }\n}\n"],"names":["tslib_1.__extends"],"mappings":";;;;;;;;;;;AAEA,IAAa,sBAAsB,GAAG,IAAI,cAAc,CAAC,wBAAwB,CAAC;;;;AAElF,yCAgDC;;;;;;IA5CC,yCAAa;;;;;;;;;IASb,8CAA6B;;;;;IAK7B,gDAAoC;;;;;;IAMpC,6CAAiB;;;;;;IAMjB,uDAA2B;;;;;;IAM3B,uDAA2B;;;;;;IAM3B,gDA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,CAAC;oBACxB,KAAK,EAAE,IAAI;iBACZ;aACF;SACF,CAAC;KACH;;gBA1BF,QAAQ;;IA2BT,gCAAC;CA3BD;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"function","parameters":["options"],"value":{"reconnectInterval":5000,"reconnectAttempts":10,"typeKey":"type"}},"ɵb":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":20,"character":32},"arguments":["USER_OPTIONS"]},"ɵc":{"__symbolic":"function","parameters":["_args"],"value":{"__symbolic":"error","message":"Lambda not supported","line":55,"character":9,"module":"./src/symbols"}},"NgxsWebsocketPluginModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":22,"character":1}}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["options"],"value":{"ngModule":{"__symbolic":"reference","name":"NgxsWebsocketPluginModule"},"providers":[{"__symbolic":"reference","name":"ɵd"},{"provide":{"__symbolic":"reference","name":"ɵb"},"useValue":{"__symbolic":"reference","name":"options"}},{"provide":{"__symbolic":"reference","name":"NGXS_WEBSOCKET_OPTIONS"},"useFactory":{"__symbolic":"reference","name":"ɵa"},"deps":[{"__symbolic":"reference","name":"ɵb"}]},{"provide":{"__symbolic":"reference","module":"@angular/core","name":"APP_INITIALIZER","line":41,"character":19},"useFactory":{"__symbolic":"reference","name":"ɵc"},"deps":[{"__symbolic":"reference","name":"ɵd"}],"multi":true}]}}}},"NGXS_WEBSOCKET_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":2,"character":42},"arguments":["NGXS_WEBSOCKET_OPTIONS"]},"NgxsWebsocketPluginOptions":{"__symbolic":"interface"},"ConnectWebSocket":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":62,"character":13}}},"WebsocketMessageError":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":73,"character":13}}},"DisconnectWebSocket":{"__symbolic":"class","members":{},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":84,"character":13}}},"WebSocketDisconnected":{"__symbolic":"class","members":{},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":103,"character":13}}},"SendWebSocketMessage":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"any"}]}]},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":113,"character":13}}},"WebSocketConnectionUpdated":{"__symbolic":"class","members":{},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":124,"character":13}}},"WebSocketConnected":{"__symbolic":"class","members":{},"statics":{"type":{"__symbolic":"error","message":"Variable not initialized","line":94,"character":13}}},"ɵd":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":19,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":51,"character":5},"arguments":[{"__symbolic":"reference","name":"NGXS_WEBSOCKET_OPTIONS"}]}]],"parameters":[{"__symbolic":"reference","module":"@ngxs/store","name":"Store","line":49,"character":19},{"__symbolic":"reference","module":"@ngxs/store","name":"Actions","line":50,"character":22},{"__symbolic":"reference","name":"NgxsWebsocketPluginOptions"}]}],"ngOnDestroy":[{"__symbolic":"method"}],"setupActionsListeners":[{"__symbolic":"method"}],"connect":[{"__symbolic":"method"}],"disconnect":[{"__symbolic":"method"}],"send":[{"__symbolic":"method"}],"mergeConfigWithOptions":[{"__symbolic":"method"}],"updateConnection":[{"__symbolic":"method"}],"dispatchWebSocketDisconnected":[{"__symbolic":"method"}],"closeConnection":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/websocket.module","ɵb":"./src/websocket.module","ɵc":"./src/symbols","NgxsWebsocketPluginModule":"./src/websocket.module","NGXS_WEBSOCKET_OPTIONS":"./src/symbols","NgxsWebsocketPluginOptions":"./src/symbols","ConnectWebSocket":"./src/symbols","WebsocketMessageError":"./src/symbols","DisconnectWebSocket":"./src/symbols","WebSocketDisconnected":"./src/symbols","SendWebSocketMessage":"./src/symbols","WebSocketConnectionUpdated":"./src/symbols","WebSocketConnected":"./src/symbols","ɵd":"./src/websocket-handler"},"importAs":"@ngxs/websocket-plugin"}