Skip to content

Instantly share code, notes, and snippets.

@erubboli
Created July 28, 2011 14:48
Show Gist options
  • Save erubboli/1111670 to your computer and use it in GitHub Desktop.
Save erubboli/1111670 to your computer and use it in GitHub Desktop.
Node faye issue
var http = require('http'),
faye = require('faye');
var bayeux = new faye.NodeAdapter({mount: '/test', timeout: 45});
bayeux.listen(8000);
require 'faye'
bayeux = Faye::RackAdapter.new(:mount => '/test', :timeout => 25)
bayeux.listen(8000)
require 'faye'
@client = Faye::Client.new('http://localhost:8000/test')
EM.run do
@client.subscribe('/*') do |message|
puts message.inspect
end
end
require 'net/http'
require 'json'
10.times do |n|
message = {
:channel => "/#{n}",
:data => { :msg => 'obladioblada ', :id => n}
}
uri = URI.parse('http://localhost:8000/test')
Net::HTTP.post_form(uri, :message => JSON.generate(message))
end
{"msg"=>"obladioblada ", "id"=>0}
{"msg"=>"obladioblada ", "id"=>1}
{"msg"=>"obladioblada ", "id"=>0}
{"msg"=>"obladioblada ", "id"=>1}
{"msg"=>"obladioblada ", "id"=>2}
{"msg"=>"obladioblada ", "id"=>3}
{"msg"=>"obladioblada ", "id"=>4}
{"msg"=>"obladioblada ", "id"=>5}
{"msg"=>"obladioblada ", "id"=>6}
{"msg"=>"obladioblada ", "id"=>7}
{"msg"=>"obladioblada ", "id"=>8}
{"msg"=>"obladioblada ", "id"=>9}
{"msg"=>"obladioblada ", "id"=>10}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment