Class: Funnel::WebSocket::Connection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Funnel::WebSocket::Connection
- Defined in:
- lib/funnel/web_socket/connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
-
#cookies ⇒ Object
helper methods.
- #host ⇒ Object
-
#on_data(data) ⇒ Object
override this.
-
#on_disconnect ⇒ Object
override this.
-
#on_ready ⇒ Object
override this.
- #origin ⇒ Object
- #path ⇒ Object
-
#post_init ⇒ Object
called from EM.
- #protocol ⇒ Object
-
#receive_data(data) ⇒ Object
called from EM.
- #send_message(msg) ⇒ Object
-
#unbind ⇒ Object
called from EM.
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/funnel/web_socket/connection.rb', line 6 def headers @headers end |
Instance Method Details
#cookies ⇒ Object
helper methods
12 13 14 |
# File 'lib/funnel/web_socket/connection.rb', line 12 def @headers[:cookies] end |
#host ⇒ Object
16 17 18 |
# File 'lib/funnel/web_socket/connection.rb', line 16 def host @headers[:host] end |
#on_data(data) ⇒ Object
override this
45 46 47 |
# File 'lib/funnel/web_socket/connection.rb', line 45 def on_data data puts "Data" end |
#on_disconnect ⇒ Object
override this
40 41 42 |
# File 'lib/funnel/web_socket/connection.rb', line 40 def on_disconnect puts "Disconnect" end |
#on_ready ⇒ Object
override this
35 36 37 |
# File 'lib/funnel/web_socket/connection.rb', line 35 def on_ready puts "Connect" end |
#origin ⇒ Object
20 21 22 |
# File 'lib/funnel/web_socket/connection.rb', line 20 def origin @headers[:origin] end |
#path ⇒ Object
24 25 26 |
# File 'lib/funnel/web_socket/connection.rb', line 24 def path @headers[:path] end |
#post_init ⇒ Object
called from EM
55 56 57 58 |
# File 'lib/funnel/web_socket/connection.rb', line 55 def post_init @headers = {} on_ready end |
#protocol ⇒ Object
28 29 30 |
# File 'lib/funnel/web_socket/connection.rb', line 28 def protocol @headers[:websocket_protocol] end |
#receive_data(data) ⇒ Object
called from EM
61 62 63 |
# File 'lib/funnel/web_socket/connection.rb', line 61 def receive_data data on_data Frame.decode(data) end |
#send_message(msg) ⇒ Object
65 66 67 |
# File 'lib/funnel/web_socket/connection.rb', line 65 def msg send_data Frame.encode(msg) end |
#unbind ⇒ Object
called from EM
50 51 52 |
# File 'lib/funnel/web_socket/connection.rb', line 50 def unbind on_disconnect end |