Class: WildSoNet::Streamer::Connection
- Inherits:
-
Object
- Object
- WildSoNet::Streamer::Connection
- Includes:
- ChannelFutureListener
- Defined in:
- lib/handler.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(context, encoder) ⇒ Connection
constructor
A new instance of Connection.
- #operationComplete(future) ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize(context, encoder) ⇒ Connection
Returns a new instance of Connection.
45 46 47 48 |
# File 'lib/handler.rb', line 45 def initialize context, encoder @context = context @encoder = encoder end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
43 44 45 |
# File 'lib/handler.rb', line 43 def context @context end |
#id ⇒ Object
Returns the value of attribute id.
41 42 43 |
# File 'lib/handler.rb', line 41 def id @id end |
#type ⇒ Object
Returns the value of attribute type.
42 43 44 |
# File 'lib/handler.rb', line 42 def type @type end |
Instance Method Details
#operationComplete(future) ⇒ Object
61 62 63 |
# File 'lib/handler.rb', line 61 def operationComplete future future.channel.close if future.isDone() end |
#write(data) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/handler.rb', line 50 def write data case @type when "message" data = @encoder.(data) @context.channel.write(data).addListener(self) when "script" data = @encoder.script(data) @context.channel.write(data) end end |