Tribe EM AMF Socket
This Ruby gem provides AMF Socket bindings for Tribe EM. Currently sending and receive messages is integrated (requests are not).
Installation
Add this line to your application's Gemfile:
gem 'tribe_em_amfsocket'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tribe_em_amfsocket
Usage
# Create a custom connection actor class.
class EchoConn < Tribe::EM::AmfSocket::Connection
private
def exception_handler(e)
super
puts concat_e("EchoConn (#{identifier}) died.", e)
end
def post_init_handler
puts "EchoConn (#{identifier}) connected to client using thread (#{Thread.current.object_id})."
end
def unbind_handler
puts "EchoConn (#{identifier}) disconnected from client using thread (#{Thread.current.object_id})."
end
def ()
puts "EchoConn (#{identifier}) received message (message=#{} using thread (#{Thread.current.object_id})."
(.command, .params)
shutdown!
end
end
# Create your server actor.
server = Tribe::EM::TcpServer.new('localhost', 9000, EchoConn)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request