lifo / cramp

Real-time web application framework in Ruby
http://cramp.in
MIT License
1.5k stars 121 forks source link

added push_data callback #17

Closed zambot closed 13 years ago

zambot commented 13 years ago

this commit adds a callback that a controller can register that can be triggered from the application (backend). This callback can then render data to the client. In this way you can get rid of the periodic timer function, that in my opinion doesnt belong to most event based systems. Please tell me what you think about this and sorry for no feature branch.

for a demo see my edited version of akitaonrails websocket chat example.

lifo commented 13 years ago

Problem is, it doesn't scale across multiple processes/hosts. Usually it's better to use something like Redis pub/sub. But using periodic timers does the job with traditional dbs like MySQL.