Skip to content

Instantly share code, notes, and snippets.

@JonasNielsen
Created February 22, 2011 09:27
Show Gist options
  • Save JonasNielsen/838411 to your computer and use it in GitHub Desktop.
Save JonasNielsen/838411 to your computer and use it in GitHub Desktop.
# Inside EM::Connection 'receive_data(d)' loop
logger.debug "New price received"
extraction = proc {
logger.debug "Extracting price info"
extract_price_information(response) # Use libxml to match response with a schema and extract values
}
callback = proc { |price|
push_to_pusher(price) # Uses pusherapp to broadcast price
}
EM.defer(extraction, callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment