Class: DRb::WebSocket::ClientSide

Inherits:
Object
  • Object
show all
Defined in:
lib/drb/websocket/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri, config, handler) ⇒ ClientSide

Returns a new instance of ClientSide.



91
92
93
94
95
96
97
98
# File 'lib/drb/websocket/client.rb', line 91

def initialize(uri, config, handler)
  @uri = uri
  @res = nil
  @config = config
  @msg = DRbMessage.new(config)
  @proxy = ENV['HTTP_PROXY']
  @handler = handler
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/drb/websocket/client.rb', line 103

def alive?
  false
end

#closeObject



100
101
# File 'lib/drb/websocket/client.rb', line 100

def close
end

#recv_replyObject



113
114
115
116
117
118
119
120
121
# File 'lib/drb/websocket/client.rb', line 113

def recv_reply
  reply_stream = @handler.stream
  begin
    @msg.recv_reply(reply_stream)
  rescue
    close
    raise $!
  end
end

#send_request(ref, msg_id, *arg, &b) ⇒ Object



107
108
109
110
111
# File 'lib/drb/websocket/client.rb', line 107

def send_request(ref, msg_id, *arg, &b)
  stream = StrStream.new
  @msg.send_request(stream, ref, msg_id, *arg, &b)
  @handler.send(@uri, stream.buf)
end