tribe_em_amfsocket 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # TribeEmAmfsocket
1
+ # Tribe EM AMF Socket
2
2
 
3
- TODO: Write a gem description
3
+ This Ruby gem provides AMF Socket bindings for [Tribe EM] (https://github.com/chadrem/tribe_em "Tribe EM").
4
+ Currently sending and receive messages is integrated (requests are not).
4
5
 
5
6
  ## Installation
6
7
 
@@ -18,7 +19,29 @@ Or install it yourself as:
18
19
 
19
20
  ## Usage
20
21
 
21
- TODO: Write usage instructions here
22
+ # Create a custom connection actor class.
23
+ class EchoConnection < Tribe::EM::AmfSocket::Connection
24
+ private
25
+
26
+ def on_post_init(event)
27
+ puts "Actor (#{identifier}) connected to client using thread (#{Thread.current.object_id})."
28
+ super
29
+ end
30
+
31
+ def on_unbind(event)
32
+ puts "Actor (#{identifier}) disconnected from client using thread (#{Thread.current.object_id})."
33
+ super
34
+ end
35
+
36
+ def on_receive_message(event)
37
+ puts "Actor (#{identifier}) received message (command=#{event.data.command}, params=#{event.data.params} using thread (#{Thread.current.object_id})."
38
+ write_message(event.data.command, event.data.params)
39
+ enqueue(:shutdown)
40
+ end
41
+ end
42
+
43
+ # Create your server actor.
44
+ server = Tribe::EM::TcpServer.new('localhost', 9000, EchoConnection)
22
45
 
23
46
  ## Contributing
24
47
 
@@ -1,7 +1,7 @@
1
1
  module Tribe
2
2
  module EM
3
3
  module AmfSocket
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
6
6
  end
7
7
  end
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
19
 
20
- gem.add_dependency('tribe_em', '0.0.2')
20
+ gem.add_dependency('tribe_em', '0.0.3')
21
21
  gem.add_dependency('amf_socket', '0.3.1')
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tribe_em_amfsocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.2
21
+ version: 0.0.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.2
29
+ version: 0.0.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: amf_socket
32
32
  requirement: !ruby/object:Gem::Requirement