I found this example of using faye for a chatroom type app as I am
trying to get a feel for push servers:
I got some of that to work, although multiuser from the same browser
doesn't exactly make sense.
I then tried to look into a server side client. I am using a windows
laptop for everything.
I have the following code below which publishes a message to the
chatroom fine, but it never really exits.
The last statement "puts 'end'" is never reached. If I put EM.stop or
an exit statement inside the event machine block, then the messages
don't make it to the chat room.
The other thin I noticed is if I have a loop that puts say 5 messages
to the chat room, but sleeps for several seconds between each. They
don't show up until they have all been published. It's like it needs
to reach the bottom of the block, but once there it never exits the
client = Faye::Client.new(‘http://localhost:9292/faye’)
client.subscribe('/messages/public') do |message|
client.publish('/messages/public', 'username' => 'Joe',
'msg' => "hey there again")