Class: WildSoNet::Streamer::Handler
- Inherits:
-
SimpleChannelUpstreamHandler
- Object
- SimpleChannelUpstreamHandler
- WildSoNet::Streamer::Handler
- Defined in:
- lib/handler.rb
Instance Attribute Summary collapse
-
#encoder ⇒ Object
Returns the value of attribute encoder.
Instance Method Summary collapse
Instance Attribute Details
#encoder ⇒ Object
Returns the value of attribute encoder.
9 10 11 |
# File 'lib/handler.rb', line 9 def encoder @encoder end |
Instance Method Details
#channelClosed(context, event) ⇒ Object
31 32 33 |
# File 'lib/handler.rb', line 31 def channelClosed context, event WildSoNet::Streamer::Server.unregister(context..id, context.) end |
#messageReceived(context, event) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/handler.rb', line 11 def context, event = event.getMessage if result = /^GET \/streamer\/([a-z]+)\/(.+) HTTP\/1\..$/.match() connection = Connection.new(context, @encoder) connection.type = result[1] connection.id = result[2] context. = connection end if == "" context.channel.write("HTTP/1.1 200 OK\r\n") context.channel.write("Content-Type: text/html; charset=UTF-8\r\n") context.channel.write("\r\n") WildSoNet::Streamer::Server.register(context..id, context.) end end |