Hello Nguyen
One way for you to do could be for example set a periodic timer in your ruby controller and poll for changes from your web-server and perform your desired action.
You could for example use sockets to communicate with your web server or use any distributed K/V store, redis could be one.
Regards
Nick Karanatsios
PS. The trema c library provides the ability to set an external callback that would be called from inside the event loop but unfortunately this feature has not been implemented in ruby controller.