Giter Club home page Giter Club logo

Comments (4)

fokusferit avatar fokusferit commented on August 18, 2024

Sorry for the additional post, but i think i found one Bug which is related to subscriptions and using mongodb.

With the current implementation, i'm getting this error "tailable cursor requested on non capped collection ..." each time i want to subscribe to an device. I was able to fix this issue in the databse.js with creating the database collection directly with the "capped: true" property. Without this option it is not possible to use tailable cursors". I don't know if this is related to some changes in mongodb (tested version: 2.6.3). I will make a Pull-Request for this.

Unfortunately, i was not able to fix the issue with NeDB.

from meshblu.

chrismatthieu avatar chrismatthieu commented on August 18, 2024

Thanks for the heads-up. That bug is on our list (Basecamp #212).

Subscribe should work with MQTT and WebSocket protocols. We are planning to redirect HTTP and CoAP subscriptions to Redis rather than tailing Mongo. This may still be an issue for Raspberry Pis and other smaller devices that may not have enough processing power to run Redis.

from meshblu.

fokusferit avatar fokusferit commented on August 18, 2024

Ok, thanks for the info!
And for using subscriptions with Mongo, i think i've fixed that with adding the following to database.js:

if(config.mongo){

  var mongojs = require('mongojs');
  var db = mongojs(config.mongo.databaseUrl);
  var devices = db.createCollection('devices' , {capped: true, size:10000,max:1000}, function() {
    // do something here
    console.log("Devices collection created");
  });
  var events = db.createCollection('events' , {capped: true, size:10000,max:1000}, function() {
    // do something here
    console.log("Events collection created");
  });
  var data = db.createCollection('data' , {capped: true, size:10000,max:1000}, function() {
    // do something here
    console.log("Data collection created");
  });
  module.exports = {
    devices: db.collection('devices'),
    events: db.collection('events'),
    data: db.collection('data')
  };

} 

For now, it is working fine for me (WebSocket subscriptions tested).

from meshblu.

chrismatthieu avatar chrismatthieu commented on August 18, 2024

Cool. You should only need to cap the events collection.

from meshblu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.