Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
71 lines (51 sloc) 1.41 KB

README

Build Status

Code Climate

Basics

server.rb (forks a subprocess):

EM.popen("ruby [...] -e 'MyClient.new'", ClientConnection)

agent.rb (in order to receive input the stdin will be attached to EM)

EM::attach($stdin, ServerConnection)

Messages

JSON is used for messages

{
  status: 'ready'
}

{
  message: 'action',
  arguments: [arg1,arg2]
}

{
  receiver: <uuid_for_population>
  message: 'action',
  arguments: [arg1,arg2]
}

a message that expects a return value

{
  message: 'action',
  arguments: [arg1,arg2],
  return: uuid
}

{
  return: uuid,
  value: 'return value'
}

Credits

Thanks to

  • Avdi Grimm for his series 'A dozen (or so) ways to start sub-processes in Ruby' part 1, part 2 and part 3
  • Tass Cyberspace for inspiring me back

Copyright

Copyright (c) 2012 Alessandro Di Maria. See LICENSE.txt for further details.