angularmeteorangular-meteorddprocket.chat

Using DDP in Angular 4 Application


I am Angular 4 developer. Want to include RocketChat Engine developed in MeteorJS. By research I got to know that it will need DDP(Protocol) to connect Angular4 with Meteor.

I am unable to find any DDP package which allows me to integrate with Angular4 TypeScript.

Can you please help me out in this?


Solution

  • You could use a plain DDP packages. Probably the most popular one is mondora's asteroid.

    But you could also use Meteor's own packages.

    The advantages are that they are better maintained and also they include not only DDP but also a local cache implementations and Mongo API on the client.

    You don't need to use the Meteor build system for that, here is a blog post about meteor-client-bundler.

    Once you have that, the best way to integrate Meteor's DDP with Angular is through Meteor-RxjS.

    Here is a simple example using the AngularCLI and a tutorial that uses Ionic. - and here you can check out a small example with the Angular CLI.

    As a side note, it looks like the future protocol you would want to use is GraphQL and GraphQL-Subscriptions for real time.

    We've recently made a PR for RocketChat to support GraphQL - https://github.com/RocketChat/Rocket.Chat/pull/8158 I hope they will merge that soon.

    In this PR you can check out an AngularCLI with PWA that uses RocketChat's new GraphQL API - https://github.com/RocketChat/Rocket.Chat.PWA/pull/32