0

I'm trying to learn Node.js and Socket.io

I'm trying to create a page that will display the values of a database table whenever changes are detected.

For simplicity, I would only be changing the values of the database table via PHPMyAdmin manually.

Would this be possible? If so, could you point me in the right direction so that I can try it out.

asp.patrickg
  • 269
  • 1
  • 2
  • 13
  • If your database is mySQL (judging by the tag), then this may be relevant: [Watching a table for change in MySQL?](http://stackoverflow.com/questions/167254/watching-a-table-for-change-in-mysql). FYI, questions about code that don't contain any of the code you have so far rarely get great answers here because you aren't sharing any specifics of what you've done so far. – jfriend00 Aug 14 '15 at 01:04
  • @jfriend00 Yes I will use MySQL and thanks for the link, I'll take a look at it now. On a side note, I wasn't really asking for code. I was just asking for links to the right direction as my searches haven't worked so far. Here's what I was reading on: http://www.gianlucaguarini.com/blog/nodejs-and-a-simple-push-notification-server/ and https://www.npmjs.com/package/mysql-events So far I can't even start as I get errors when installing socket.io – asp.patrickg Aug 14 '15 at 01:48
  • Most databases can be used by just polling them (e.g. running a SELECT query each X seconds to look for new data): this includes MySQL, MongoDB and many more. Alternatively, you may want to look at databases like RethinkDB or Redis that supports notifications (when a value is changed, they send a notification to your application) – ItalyPaleAle Aug 14 '15 at 02:56
  • @Qualcuno Would it be possible to not go for long polling? We're trying to move away from polling as it slows down our servers by a lot. Also, I have no control of the database so I will stick with MySQL. – asp.patrickg Aug 14 '15 at 04:54
  • @asp.patrickg you will still need to add for example a Redis layer on top. You can use MySQL for persistent storage, but MySQL doesn't support pushing events – ItalyPaleAle Aug 14 '15 at 15:47

0 Answers0