8000 GitHub - jdudek/pusher-async: Allows asynchronous use of Pusher by running EventMachine in separate thread
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jdudek/pusher-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pusher::Async

Pusher allows you to make async requests provided you're running within EventMachine loop. This is often not the case when you're using non-evented server like Unicorn. Pusher::Async will run EventMachine reactor in separate thread to allow you making async requests within this thread.

Pusher::Async will also gracefully handle forking and start the reactor thread in child processes.

WARNING: this was very barely tested so expect things to break!

Usage

Within Rails

Just add

gem "pusher-async"

to your Gemfile. This will add a middleware to your app that will take care of starting EventMachine in forked processes.

Outside of Rails

Add the middleware to your Rack app manually.

Notes

If you want to attach callbacks/errbacks to deferreds returned from Pusher requests, keep in mind they will run in different thread (the one EventMachine uses). Issues with thread-safety may arise.

You should be fine if all you need is to trigger Pusher events and you don't check for request result.

Inspired by

License

MIT.

About

Allows asynchronous use of Pusher by running EventMachine in separate thread

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0