Class: Whoosh::Streaming::WebSocket::AsyncWSWrapper
- Inherits:
-
Object
- Object
- Whoosh::Streaming::WebSocket::AsyncWSWrapper
- Defined in:
- lib/whoosh/streaming/websocket.rb
Overview
Wrapper to give async-websocket the same #send interface
Instance Method Summary collapse
- #close(code = 1000, reason = "") ⇒ Object
-
#initialize(connection) ⇒ AsyncWSWrapper
constructor
A new instance of AsyncWSWrapper.
- #send(data) ⇒ Object
Constructor Details
#initialize(connection) ⇒ AsyncWSWrapper
Returns a new instance of AsyncWSWrapper.
143 144 145 |
# File 'lib/whoosh/streaming/websocket.rb', line 143 def initialize(connection) @connection = connection end |
Instance Method Details
#close(code = 1000, reason = "") ⇒ Object
152 153 154 |
# File 'lib/whoosh/streaming/websocket.rb', line 152 def close(code = 1000, reason = "") @connection.close end |
#send(data) ⇒ Object
147 148 149 150 |
# File 'lib/whoosh/streaming/websocket.rb', line 147 def send(data) @connection.write(Protocol::WebSocket::TextMessage.generate(data)) @connection.flush end |