tribe_em_amfsocket 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -11
- data/lib/tribe_em_amfsocket/actor_proxy.rb +2 -2
- data/lib/tribe_em_amfsocket/connection.rb +13 -12
- data/lib/tribe_em_amfsocket/version.rb +1 -1
- data/tribe_em_amfsocket.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4caf3cd5df2a8c16ea3fa6fd0344e2d384452ad0
|
|
4
|
+
data.tar.gz: 8d48a65621efa83b0aaa7d34ac2aa61d2d2e311f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 982a554eeb37d287db44270c857f5a4d8088cdbfe0e2b0f1ca050c2c523f9ab7e5f95f11caa2fc0768ba1913a7cbb67876844487714eba78b7edc27974a140ec
|
|
7
|
+
data.tar.gz: 4642a52c6f9bfbe9e3069b52cf78de707456fb642a0114911cc211494fcad2b6d4e1fad5d702be22c9abff30ced062db97ce43a21b9398bc4680761069527b7c
|
data/README.md
CHANGED
|
@@ -20,28 +20,30 @@ Or install it yourself as:
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
# Create a custom connection actor class.
|
|
23
|
-
class
|
|
23
|
+
class EchoConn < Tribe::EM::AmfSocket::Connection
|
|
24
24
|
private
|
|
25
|
-
|
|
26
|
-
def on_post_init(event)
|
|
27
|
-
puts "Actor (#{identifier}) connected to client using thread (#{Thread.current.object_id})."
|
|
25
|
+
def exception_handler(e)
|
|
28
26
|
super
|
|
27
|
+
puts concat_e("EchoConn (#{identifier}) died.", e)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
|
-
def
|
|
32
|
-
puts "
|
|
33
|
-
|
|
30
|
+
def post_init_handler
|
|
31
|
+
puts "EchoConn (#{identifier}) connected to client using thread (#{Thread.current.object_id})."
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def unbind_handler
|
|
35
|
+
puts "EchoConn (#{identifier}) disconnected from client using thread (#{Thread.current.object_id})."
|
|
34
36
|
end
|
|
35
37
|
|
|
36
|
-
def
|
|
37
|
-
puts "
|
|
38
|
-
write_message(
|
|
38
|
+
def receive_message_handler(message)
|
|
39
|
+
puts "EchoConn (#{identifier}) received message (message=#{message} using thread (#{Thread.current.object_id})."
|
|
40
|
+
write_message(message.command, message.params)
|
|
39
41
|
shutdown!
|
|
40
42
|
end
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
# Create your server actor.
|
|
44
|
-
server = Tribe::EM::TcpServer.new('localhost', 9000,
|
|
46
|
+
server = Tribe::EM::TcpServer.new('localhost', 9000, EchoConn)
|
|
45
47
|
|
|
46
48
|
## Contributing
|
|
47
49
|
|
|
@@ -16,7 +16,7 @@ module Tribe
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
#
|
|
19
|
-
# EM Callbacks.
|
|
19
|
+
# EM Callbacks.
|
|
20
20
|
#
|
|
21
21
|
|
|
22
22
|
public
|
|
@@ -38,7 +38,7 @@ module Tribe
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
#
|
|
41
|
-
# Public methods. Call these from the associated actor
|
|
41
|
+
# Public methods. Call these from the associated actor.
|
|
42
42
|
#
|
|
43
43
|
|
|
44
44
|
public
|
|
@@ -8,26 +8,27 @@ module Tribe
|
|
|
8
8
|
|
|
9
9
|
private
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
super
|
|
11
|
+
def write(data)
|
|
12
|
+
raise 'This method can not be used with AMF Socket.'
|
|
14
13
|
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
super
|
|
15
|
+
def write_message(command, params = {})
|
|
16
|
+
@_actor_proxy.write_message(command, params)
|
|
19
17
|
end
|
|
20
18
|
|
|
21
|
-
#
|
|
19
|
+
#
|
|
20
|
+
# Command handlers.
|
|
21
|
+
#
|
|
22
|
+
|
|
22
23
|
def on_receive_message(event)
|
|
24
|
+
receive_message_handler(event.data)
|
|
23
25
|
end
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
#
|
|
28
|
+
# System handlers.
|
|
29
|
+
#
|
|
28
30
|
|
|
29
|
-
def
|
|
30
|
-
@actor_proxy.write_message(command, params)
|
|
31
|
+
def receive_message_handler(message)
|
|
31
32
|
end
|
|
32
33
|
end
|
|
33
34
|
end
|
data/tribe_em_amfsocket.gemspec
CHANGED
|
@@ -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.
|
|
20
|
+
gem.add_dependency('tribe_em', '~> 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.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chad Remesch
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ~>
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0.
|
|
19
|
+
version: '0.3'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ~>
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0.
|
|
26
|
+
version: '0.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: amf_socket
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|