You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aleksei Chernenkov edited this page Jun 21, 2022
·
3 revisions
The embedding API allows you to start Rpush within an existing process. Calling Rpush.embed will start Rpush in a thread. Rpush will attach an at_exit hook to perform a graceful shutdown. If you need to manually shutdown Rpush you can call Rpush.shutdown.
The embedding API also provides Rpush.sync for synchronizing apps (aka Hot App Updates).
WARNING! Please note that only a single instance of Rpush should ever be running per Rails environment. If you deploy multiple instances of your application and intend to start Rpush within one of those instances, you will need to ensure only a single instance spawns Rpush.
Typically you want Rpush to start along with your web server, so the best place for calling Rpush.embed would be config.ru (Rack configuration file). Placing Rpush.embed in Rails initializer or another configuration file may result in running Rpush in Rake tasks, Rails console and other processes (e.g. Sidekiq). Be careful!