lib/sinatra/cometio/client.rb in sinatra-cometio-0.5.5 vs lib/sinatra/cometio/client.rb in sinatra-cometio-0.5.6
- old
+ new
@@ -21,11 +21,13 @@
@timeout = 120
end
def push(type, data)
post_data = {
- :session => @session,
- :events => [{:type => type, :data => data}]
+ :json => {
+ :session => @session,
+ :events => [{:type => type, :data => data}]
+ }.to_json
}
begin
res = HTTParty.post @url, :timeout => 10, :body => post_data
emit :error, "CometIO push error" unless res.code == 200
rescue StandardError, Timeout::Error => e