diff --git a/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts b/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts index b46db31..2b26737 100644 --- a/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts +++ b/projects/loafer/ng-rpc/src/lib/client/RPCClient.ts @@ -130,15 +130,15 @@ export abstract class RPCClient { this._pendingRequests.delete(id); this._pendingRequestsCount--; - if (undefined !== result) { - reqState.subject.next(result); - } else if (undefined !== error) { + if (undefined !== error) { const rpcClientError: RPCClientError = { request: reqState.request, response: error, }; console.error(rpcClientError); reqState.subject.error(rpcClientError); + } else { + reqState.subject.next(result); } } diff --git a/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts b/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts index 27d3980..a18971d 100644 --- a/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts +++ b/projects/loafer/ng-rpc/src/lib/protocol/json/JSONRPCClientCodec.ts @@ -94,10 +94,10 @@ export class JSONRPCClientResponseCodec implements RPCClientResponseCodec { } public isNotification(): boolean { - if (undefined !== this.id() || undefined === this.result()) { - return false; + if (undefined === this.id() && undefined !== this.result()) { + return true; } - return true; + return false; } public notification(): RPCClientNotificationCodec | undefined {