Skip to content

Instantly share code, notes, and snippets.

@knowtheory
Last active December 12, 2015 07:28
Show Gist options
  • Select an option

  • Save knowtheory/4736476 to your computer and use it in GitHub Desktop.

Select an option

Save knowtheory/4736476 to your computer and use it in GitHub Desktop.
module Sullivans
class UserActor
include Celluloid
include Celluloid::Notifications
include Celluloid::Logger
def initialize(socket)
# Subscribe to conversations
info "Started a client"
@socket = socket
@socket.on_message do |msg|
info msg
write msg
end
@socket.read_every 1
end
def write(msg)
info "Got a message"
@socket.write("Recieved #{msg}")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment