Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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' } ]
- );
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement