Created
July 28, 2011 14:48
-
-
Save erubboli/1111670 to your computer and use it in GitHub Desktop.
Node faye issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'), | |
| faye = require('faye'); | |
| var bayeux = new faye.NodeAdapter({mount: '/test', timeout: 45}); | |
| bayeux.listen(8000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'faye' | |
| bayeux = Faye::RackAdapter.new(:mount => '/test', :timeout => 25) | |
| bayeux.listen(8000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'faye' | |
| @client = Faye::Client.new('http://localhost:8000/test') | |
| EM.run do | |
| @client.subscribe('/*') do |message| | |
| puts message.inspect | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"msg"=>"obladioblada ", "id"=>0} | |
| {"msg"=>"obladioblada ", "id"=>1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"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