Suggestions for problem with json through event machine/Faye?

I have a process that waits for json messages on a port using event
machine and then publishes them to
faye so that javascript faye clients can subscribe and get updates.

A driver engine runs on the server and creates the json which it
writes to the port and then this process
reads it and sends it on. A faye server gets those messages for

Through looking at many examples, this is the solution I have arrived
at thus far. The problem is that
something gets hung up someplace so that the javascript clients no
longer get the subscriptions.
When that happens this process shows that it is getting the messages
and sending them to faye, but the javascript clients still don’t get
them. If I just restart this process, it works fine for awhile until
it gets hung up again. I don’t have to restart the faye server, the
rails server, nor refresh the page. I just restart this process and
that fixes it.

Is it likely that it’s because I am running this on windows ? What
else can I try ? Thanks

require ‘rubygems’
require ‘eventmachine’
require ‘faye’

Event Machine server is sent messages that it publishes

to the chat room through a Faye service.

class Server < EventMachine::Connection
attr_accessor :options, :status

def receive_data(message)
# create a Faye client
client =‘http://localhost:9292/faye’)

p message

# publish the json
client.publish('/messages/public', 'json' =>

puts “#{@status} – #{message}”

create a service through event machine to read messages through port


and send them to the chat room. do
EventMachine.start_server ‘localhost’, 2000, Server do |conn|
conn.options = {:type => ‘faye_service’}
conn.status = :OK