How to detect Mysql changes in Nodejs?

Asked

Viewed 433 times

5

Good night,

someone has already used this package or knows a similar one that works?

Link: https://www.npmjs.com/package/mysql-events

  • Goal: launch an event when there is a change in the database. Before I made a mistake saying that I was not allowed to monitor my binlog, so I set and not more error, but it doesn’t work.
  • My log file is in: C:/xampp/mysql/data

inserir a descrição da imagem aqui

  • 1

    This plugin seems to be well documented. What code did you run and didn’t work?

  • True, it’s well documented, enough... but it just doesn’t work. It’s the Quick Start part, it just has that '-'

  • You can put in the question your implementation of this example, or whatever you have and does not work?

  • It’s because I left it at work :/. But it’s the same as the example, only changes the Host, User and Password, which I’ve already connected in the Mysql package of Nodejs and I’ve done everything in the database, no problems.. No different from there, I was just thinking it could be in the archives, so I even put the photo.

  • How is your database? There are two important configuration parameters that in the example are with 'myDB.table.field.value' and 'match this string or regex', but you need to adapt...

  • Yeah, those I switched, they were the same. 'nodejs_db.posts.content.value' and 'Test'. I changed the value in DB to 'Test' and still nothing '-'.

  • I’ve already used https://github.com/numtel/mysql-live-select. To work, you need to enable Mysql binlog.

  • managed to solve?

Show 3 more comments

1 answer

1

In my view, your application has this responsive routine, ie, do something automatically when any action occurs. Correct?

If your web server supports, I suggest you use WebSocket to do exactly what you need.

The client, when connecting in your application will create a persistent connection, which will exist as long as he’s logged in. This way, you can respond from the server to a particular client (or several) always when the routine you expect is executed.

You can also use the Spring-WebSocket to facilitate your implementation. You can also use an API such as SocketJS or Socket.io javascript.

Hug.

The Spring Framework provides a Websocket API Designed to Adapt to Various Websocket Engines. Currently the list includes Websocket runtimes such as Tomcat 7.0.47+, Jetty 9.1+, Glassfish 4.1+, Weblogic 12.1.3+, and Undertow 1.0+ (and Wildfly 8.0+). Additional support may be Added as more Websocket runtimes become available.

Sources:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.