Class: DRb::WebSocket::CallbackServer::ServerSide
- Inherits:
-
Object
- Object
- DRb::WebSocket::CallbackServer::ServerSide
- Defined in:
- lib/drb/websocket/callback_server.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #close ⇒ Object
-
#initialize(wsclient, sender_id, message, config, uri) ⇒ ServerSide
constructor
A new instance of ServerSide.
- #recv_request ⇒ Object
- #send_reply(succ, result) ⇒ Object
Constructor Details
#initialize(wsclient, sender_id, message, config, uri) ⇒ ServerSide
Returns a new instance of ServerSide.
40 41 42 43 44 45 46 47 |
# File 'lib/drb/websocket/callback_server.rb', line 40 def initialize(wsclient, sender_id, , config, uri) @message = @sender_id = sender_id @wsclient = wsclient @uri = uri @config = config @msg = DRbMessage.new(@config) end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
38 39 40 |
# File 'lib/drb/websocket/callback_server.rb', line 38 def uri @uri end |
Instance Method Details
#alive? ⇒ Boolean
53 54 55 |
# File 'lib/drb/websocket/callback_server.rb', line 53 def alive? !!@wsclient end |
#close ⇒ Object
49 50 51 |
# File 'lib/drb/websocket/callback_server.rb', line 49 def close @wsclient = nil end |
#recv_request ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/drb/websocket/callback_server.rb', line 57 def recv_request begin @req_stream = StrStream.new(@message) @msg.recv_request(@req_stream) rescue close raise $! end end |
#send_reply(succ, result) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/drb/websocket/callback_server.rb', line 67 def send_reply(succ, result) begin return unless alive? stream = StrStream.new @msg.send_reply(stream, succ, result) @wsclient.send((@sender_id + stream.buf).bytes) rescue puts $!. close raise $! end end |