feathersjs-ecosystem / feathers-rest

The Feathers HTTP(S) transport plugin for REST APIs
MIT License
52 stars 25 forks source link

add angular2 http client support #64

Closed josx closed 8 years ago

josx commented 8 years ago

Right now you support as external transport jquery, request, superagent, fetch. Is there any plan to add angular2 http client support?

marshallswain commented 8 years ago

It's not in the plan. Can you explain the benefit that would come from implementing it?

josx commented 8 years ago

Let angular2 projects dont rely on external dependencies (just feathers client).

daffl commented 8 years ago

@harangue wrote the Angular 2 guide but it uses the Superagent client. If you want to avoid external dependencies why not go with websockets all the way? They're faster than using a REST client anyway.

jack-guy commented 8 years ago

@daffl Has there been any talk of separating the .jquery, .fetch, .etc from the feathers-rest library? There are a thousand and one HTTP clients out there and I think it'd be nice to be able to just add your own, or install a prebuilt-extension feathers-rest-jquery or whatever.

I think people are going to cling pretty tightly to REST for the most part since websockets are unfamiliar.

daffl commented 8 years ago

You can implement your own client as a custom service any time. Most of the existing adapters are only a couple of lines of code (see e.g. https://github.com/feathersjs/feathers-rest/blob/master/src/client/fetch.js).

But yes, I think we will potentially separate those out when making Feathers backend framework independent (see https://github.com/feathersjs/feathers/issues/258).

I still think there are many good points to be made for going websockets all the way though, especially in application that already uses Feathers as the client:

  1. Usage through the Feathers client is exactly the same
  2. You get real-time events (if you want to use them)
  3. It is faster
  4. Everything is still RESTful (as an architectural design pattern REST does not prescribe what protocol to use even though it has become synonymous with HTTP)
  5. Authentication support via feathers-authentication
  6. In most browsers with decent webtools Websockets can now also be debugged the same way as network request.
josx commented 8 years ago

thanks @daffl, I have changed my app to use websockets. Also I have found this feathers example with angular2 , websockets and observables.

elaijuh commented 8 years ago

use websocket is a good solution regardless of http client, but any perf issue if i maintain a stream traffic in websocket connection?

ekryski commented 8 years ago

@elaijuh pretty loaded question as it depends on how many connections you have and the number of servers you have. But you can throw more servers at the problem and use feathers-sync to scale easily with websockets.

daffl commented 8 years ago

I'm going to close this. From what I understand the Angular HTTP client should work with Feathers anyway (especially combined with RxJS and feathers-reactive). If someone is interested in making a feathers-rest client connector for it we're happy to help but it is not going to be a part of the official roadmap.