Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aleclarson/ddp
Meteor's latency-compensated distributed data client
https://github.com/aleclarson/ddp
Last synced: 19 days ago
JSON representation
Meteor's latency-compensated distributed data client
- Host: GitHub
- URL: https://github.com/aleclarson/ddp
- Owner: aleclarson
- License: mit
- Created: 2015-08-01T21:24:25.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-05T16:55:24.000Z (almost 6 years ago)
- Last Synced: 2024-10-13T04:07:23.154Z (24 days ago)
- Language: JavaScript
- Size: 83 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ddp v1.2.0 [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
This package is stripped from [meteor/ddp](https://atmospherejs.com/meteor/ddp) and made compatible with [React Native](https://github.com/facebook/react-native).
**Note:** This package is only for client-side usage.
## usage
```js
var DDP = require('ddp');var connection = DDP.connect('localhost:3000', {
heartbeatInterval: 17500, // Interval to send pings (in milliseconds)
heartbeatTimeout: 15000, // Timeout to close the connection if a reply isnt received (in milliseconds)
onConnected: function () { /* ... */ },
});// Subscribe to a record set.
connection.subscribe('subscriptionName', args..., {
onReady: function () { /* ... */ },
onStop: function () { /* ... */ },
});// Invoke a method passing any number of arguments.
connection.call('methodName', args..., function (error, result) { /* onComplete */ });
connection.apply('methodName', args, function (error, result) { /* onComplete */ });
```This package also exposes:
- `Meteor.connection`: This should be preferred over using `DDP.connect()`
- `Meteor.DDP`
- `DDP.randomStream()`
- `DDP.stringify()`
- `DDP.parse()`
## install
```sh
npm install aleclarson/ddp#1.2.0
```
## contributions
Pull requests are welcome, but should be against the `devel` branch.