New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-meteor

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-meteor

DDP React-native Client

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

GitHub version npm version Dependency Status devDependency Status react-native MIT bitHound Score

react-native-meteor

React-native meteor ddp adapter

What is it for ?

The purpose of this library is :

  • to set up and maintain a ddp connection with a ddp server, freeing the developer from having to do it on their own
  • be fully compatible with react-native and help react-native developers

Install

npm i --save react-native-meteor

Example usage

var Example = React.createClass({
  getInitialState: function() {
    return {
      dataSource: new ListView.DataSource({
        rowHasChanged: (row1, row2) => row1!==row2,
      }),
      loaded: false,
    };
  },
  componentDidMount: function() {
    var self = this;

    meteor.connect('http://YOURIP:3000/websocket');

    meteor.on('connected', function () {
      console.log('connected');
    });

    this.tasksSub = meteor.suscribe('tasks', function (tasks) {
      self.setState({
        dataSource: self.state.dataSource.cloneWithRows(tasks),
        loaded: true
      });
    });
 },
 componentWillUnmount: function () {
   meteor.unsuscribe(this.tasksSub);
 }
});

Public API

connect(url)

Connect to a ddp server. You have to this only once in your app.

Arguments
  • url string required

suscribe(name, collectionName, params, callback)

Subscribes to a server publication.

Arguments
  • name string required : name of the server subscription

  • collectionName string optional : name of the collection you suscribe (in case the subscription name is different than collection name)

  • params array optional : parameters to pass to the server publish function.

  • callback function required : callback called when there is a change in the publication. Returns all elements.

unsuscribe(id)

Unsubscribes to a server publication.

Arguments
  • id string required : id of the server publication

on(eventName, callback)

Callback when an event is triggered

Arguments
  • eventName string required : 'connected' and 'disconnected' only for the moment

  • callback function required

Warning

You can only do one subscription on a same collection at one time

Keywords

FAQs

Package last updated on 11 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc