Can the JsonServiceClient return observables?

Hi all,

In Angular it is standard to receive observables from http and HttpClient calls. This helps to implement a preferable, reactive programming style for the front-end.

Is there an option somewhere to have ServiceStack’s JsonServiceClient do the same?

No there’s no dependency on Rx or Observables in any ServiceStack library.

@mythz - revisiting this topic - is there a specific design decision behind this? Is it simply to ensure portability across JS frameworks? Or is there a more fundamental reason, such as Rx and/or Observables is overkill/wrong approach for basic binding to model data? It seems this limitation makes the TypeScript ServiceClient less compatible with current Angular design guidance, which is a shame due to all of the other benefits it brings, but perhaps there is a good reason that I’m not seeing.

The @servicestack/client libraries has no runtime dependencies just a polyfill for a missing fetch implementation to ensure a minimal footprint and maximum compatibility.

For Angular you can still leverage your TypeScript DTOs interface definitions (.d.ts) with Angular’s built-in HTTP Client with your APIs route definitions (emitted in comments above Request DTOs), e.g:

import { createUrl } from '@servicestack/client';
...

this.http.get<HelloResponse>(createUrl('/hello/{Name}', { name }))
    .subscribe(r => {
        this.result = r.result;
    });