NgConnect
Easy interface with CONNECT platform instances.
I mean, its generally not tough to interface with backend services in angular, and CONNECT platform instances are also pretty straight-forward. However, I am personally the lazy type, and since the signature of CONNECT instances is known before hand and is pretty easy to handle, this would make it easier on the client side to speak with them. Note that of course this package can work with any InterConnectible service.
How To Install
npm install ng-connect
How To Import
Import the module NgConnectModule
and the service NgConnectService
in your main module file (app.module.ts
),
add NgConnectModule
to @NgModule
's imports
field and NgConnectService
to its providers
field:
;
How To Use
You need to create one backend instance per backend service you want to connect to. I would personally suggest creating a service that manages these backend instances, however you can create them wherever you have access to DI.
;
Then you can make calls to backend nodes easily:
; response.out.X.subscribeconsole.log'X:: ' + outX;response.out.Y.subscribeconsole.log'Y:: ' + outY;response.control.Z.subscribeconsole.log'Z!';
this is assuming that /some/node/
has the following signature:
the backend will receive the whole registry signature upon connection (invokation of connect()
), and hence will automatically figure out the proper method of the request, the proper way to send the data, etc. if insufficient inputs are provided, the backend will check on the client side and throw proper errors.
NOTE the request will be made upon invokation of backend.call()
and does not matter if you subscribe to the response object or not. If you subscribe after the server has responded, obviously you will miss out on the data.