I had a problem using the numtel meteor package to send and receive MySql information over the network (the database is on the server). Currently, it can display information from db on the screen using its package, but the problem occurs after the first download. At the first boot, it can extract information from the database and display it on the screen, but after that it seems that the triggers are broken, but only a few. I can send information to the server, but it does not seem to work with dynamic extraction. Information is sent to the server just fine, but the information is then not retrieved or displayed back on the screen. It also only breaks once when I add the tunnel code. Previously, it worked and received updates when using the database on one computer.
messages = new MysqlSubscription('getMessages'); messages.addEventListener('update', function(diff, data) { console.log("Event listener"); }); if (Meteor.isClient) { Template.messageHistory.helpers({ messages: function () { return messages.reactive(); } }); } if (Meteor.isServer) { var Tunnel = Meteor.npmRequire('tunnel-ssh'); var config = { host: "ourhost", username: "uname", password: "password", port:22, dstPort:3306, srcPort:3307, }; Tunnel.tunnel(config, function(err) { (err == null) ? console.log(config) : console.log(err) }) var liveDb = new LiveMysql({ host:"localhost", port:3307, database: "db", user: "root", password: "password" }); Meteor.publish('getMessages', function() { return liveDb.select( 'SELECT * FROM messages ORDER BY Timestamp', [ { table: 'messages' } ] ); }); }
source share