Live update not working with numtel:mysql


#1

Why is not updated on the site when a change to the database In the Data?

Case = new MysqlSubscription(‘allCase’);
TopUser = new MysqlSubscription(‘TopUser’);
//User = new MysqlSubscription(‘TopUser’);

if (Meteor.isClient) {

Template.top.helpers({
   TopUser: function () {
     TopUser.depend();
       console.log(TopUser);
      return TopUser.reactive();
    }
});
Template.footer.helpers({
    stats: function () {
       
        return {
            case: 50
        };
    }
});
Template.index.helpers({
    cases: function () {
        return Case.reactive();
    }
});

}

if (Meteor.isServer) {
var liveDb = new LiveMysql({
host: ‘localhost’
, user: ‘case’
, password: ‘case’
, database: ‘case’
, minInterval: 200
});

var closeAndExit = function () {
    liveDb.end();
    process.exit();
};
// Close connections on hot code push
process.on('SIGTERM', closeAndExit);
// Close connections on exit (ctrl + c)
process.on('SIGINT', closeAndExit);
Meteor.startup(function () {
    Tracker.autorun(function () {
        console.log('There are ' + TopUser + ' posts');
    });
});
Meteor.publish('TopUser', function () {
    return liveDb.select(
        'select `users`.`id`, `users`.`username`, `users`.`avatar`, `users`.`steamid64`, `game`.`case` as `case`, SUM(game.price) as top_value, SUM(case.price) as moneys, COUNT(game.id) as games_played from `users` inner join `game` on `game`.`userid` = `users`.`id` and `game`.`status` = 1 and `case` > 0 inner join `case` on `case`.`id` = `game`.`case` group by `users`.`id` order by `top_value` desc limit 20', [{
            table: 'user'
            }]
    );
});
Meteor.publish('allCase', function () {
    return liveDb.select(
        'SELECT * FROM `case` WHERE `id` != 0 ORDER BY `nomer` DESC', [{
            table: 'case'
            }]
    );
}); }

#2

There seems to be some weird formatting going on. Please wrap your code in triple backticks, like this:

```
paste
your
code
here
```

#3

I’ve already figured out, incorrectly indicated in the table table: ‘user’, it was necessary to table: ‘users’