ing
This commit is contained in:
parent
a34d69d9ec
commit
39dc1708e1
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@loafer/ng-rpc",
|
"name": "@loafer/ng-rpc",
|
||||||
"version": "0.0.8",
|
"version": "0.0.9",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.loafle.net/loafer/ng.git"
|
"url": "https://git.loafle.net/loafer/ng.git"
|
||||||
|
|
|
@ -12,17 +12,6 @@ const DEFAULT_RX_WEBSOCKET_CONFIG: RxWebsocketSubjectConfig<any> = {
|
||||||
url: '',
|
url: '',
|
||||||
deserializer: (e: MessageEvent) => e,
|
deserializer: (e: MessageEvent) => e,
|
||||||
serializer: (value: any) => value,
|
serializer: (value: any) => value,
|
||||||
openObserver: {
|
|
||||||
next: (e: Event) => {
|
|
||||||
this._connectionObserver.next(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
closeObserver: {
|
|
||||||
next: (e: CloseEvent) => {
|
|
||||||
this._socket = null;
|
|
||||||
this._connectionObserver.next(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
reconnectInterval: 5000,
|
reconnectInterval: 5000,
|
||||||
reconnectRetry: 10,
|
reconnectRetry: 10,
|
||||||
};
|
};
|
||||||
|
@ -45,7 +34,19 @@ export class RxWebsocketSubject extends Subject<RPCMessage> {
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
);
|
);
|
||||||
|
|
||||||
this._wsSubjectConfig = this._config = { ...DEFAULT_RX_WEBSOCKET_CONFIG };
|
this._wsSubjectConfig = { ...DEFAULT_RX_WEBSOCKET_CONFIG };
|
||||||
|
this._wsSubjectConfig.openObserver = {
|
||||||
|
next: (e: Event) => {
|
||||||
|
this._connectionObserver.next(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this._wsSubjectConfig.closeObserver = {
|
||||||
|
next: (e: CloseEvent) => {
|
||||||
|
this._socket = null;
|
||||||
|
this._connectionObserver.next(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for (const key in _config) {
|
for (const key in _config) {
|
||||||
if (_config.hasOwnProperty(key)) {
|
if (_config.hasOwnProperty(key)) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user