Class: DRb::DRbWebSocket::ClientSide
- Inherits:
-
Object
- Object
- DRb::DRbWebSocket::ClientSide
- Defined in:
- lib/drb/drb_websocket.rb
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #close ⇒ Object
-
#initialize(uri, config) ⇒ ClientSide
constructor
A new instance of ClientSide.
- #recv_reply(reply_stream) ⇒ Object
- #send(uri, data, &block) ⇒ Object
- #send_request(ref, msg_id, *arg, b, &block) ⇒ Object
Constructor Details
#initialize(uri, config) ⇒ ClientSide
Returns a new instance of ClientSide.
176 177 178 179 180 181 182 |
# File 'lib/drb/drb_websocket.rb', line 176 def initialize(uri, config) @uri = uri @pool = SocketPool.open(uri) @res = nil @config = config @msg = DRbMessage.new(@config) end |
Instance Method Details
#alive? ⇒ Boolean
184 185 186 |
# File 'lib/drb/drb_websocket.rb', line 184 def alive? !!@pool.ws && @pool.ws.open? end |
#close ⇒ Object
188 189 |
# File 'lib/drb/drb_websocket.rb', line 188 def close end |
#recv_reply(reply_stream) ⇒ Object
197 198 199 |
# File 'lib/drb/drb_websocket.rb', line 197 def recv_reply(reply_stream) @msg.recv_reply(reply_stream) end |
#send(uri, data, &block) ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/drb/drb_websocket.rb', line 201 def send(uri, data, &block) @pool.send(data) do || reply_stream = StrStream.new reply_stream.write(.to_s) if @config[:load_limit] < reply_stream.buf.size raise TypeError, 'too large packet' end block.call reply_stream end end |