Class: Envoy::Server::Channel
- Inherits:
-
Object
- Object
- Envoy::Server::Channel
- Defined in:
- lib/envoy/server/channel.rb
Instance Attribute Summary collapse
-
#trunk ⇒ Object
Returns the value of attribute trunk.
-
#web ⇒ Object
Returns the value of attribute web.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(trunk, web, header) ⇒ Channel
constructor
A new instance of Channel.
- #message(data) ⇒ Object
- #stream(data) ⇒ Object
Constructor Details
#initialize(trunk, web, header) ⇒ Channel
Returns a new instance of Channel.
9 10 11 12 13 14 15 |
# File 'lib/envoy/server/channel.rb', line 9 def initialize trunk, web, header @trunk = trunk @web = web @trunk.channels[id] = self @trunk.send_object :connection, id stream header end |
Instance Attribute Details
#trunk ⇒ Object
Returns the value of attribute trunk.
7 8 9 |
# File 'lib/envoy/server/channel.rb', line 7 def trunk @trunk end |
#web ⇒ Object
Returns the value of attribute web.
7 8 9 |
# File 'lib/envoy/server/channel.rb', line 7 def web @web end |
Instance Method Details
#id ⇒ Object
25 26 27 |
# File 'lib/envoy/server/channel.rb', line 25 def id @id ||= SecureRandom.hex(4) end |
#message(data) ⇒ Object
21 22 23 |
# File 'lib/envoy/server/channel.rb', line 21 def data @trunk.send_object :message, data end |
#stream(data) ⇒ Object
17 18 19 |
# File 'lib/envoy/server/channel.rb', line 17 def stream data @trunk.send_object :stream, id, data end |