oortcloud / node-ddp-client

A callback style DDP (Meteor's Distributed Data Protocol) node client.
Other
263 stars 80 forks source link

Use with react native Android? #71

Open tgoldenberg opened 8 years ago

tgoldenberg commented 8 years ago

Hi, This is a great package, and I have used it effectively with react native and iOS. However, now that react-native has support for the Websocket module, can this work for Android as well? And if so, it would be great to see some examples of it. With the following code, I get errors: `let ddpclient = new DDPClient({ url: 'ws://localhost:3000/websocket' });

console.log('DDP', ddpclient);
ddpclient.connect((error, wasReconnect) => {
  if (error) {
    console.log('DDP connection error!');
    return;
  }
  if (wasReconnect) {
    console.log('Reestablishment of a connection');
  }
  console.log('Connected!');
});
ddpclient.subscribe('messages', [], ()=> {
  console.log('messages complete:');
  console.log(ddpclient.collections.messages);
});

ddpclient.on('message', (msg) => {
  console.log('ddp message: ' + msg);
})`
vsivsi commented 8 years ago

There's a long-standing PR for this here: https://github.com/oortcloud/node-ddp-client/pull/56

As I say near the bottom of that thread, the issue is that a bunch of test dev and validation probably needs to happen that nobody has stepped up to do.