Class: DRb::WebSocket::ServerSide

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream, config, uri) ⇒ ServerSide

Returns a new instance of ServerSide.



222
223
224
225
226
227
# File 'lib/opal/drb/websocket.rb', line 222

def initialize(stream, config, uri)
  @uri = uri
  @config = config
  @msg = DRbMessage.new(@config)
  @req_stream = stream
end

Instance Attribute Details

#replyObject (readonly)

Returns the value of attribute reply.



220
221
222
# File 'lib/opal/drb/websocket.rb', line 220

def reply
  @reply
end

#uriObject (readonly)

Returns the value of attribute uri.



220
221
222
# File 'lib/opal/drb/websocket.rb', line 220

def uri
  @uri
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


232
# File 'lib/opal/drb/websocket.rb', line 232

def alive?; false; end

#closeObject



229
230
# File 'lib/opal/drb/websocket.rb', line 229

def close
end

#recv_requestObject



234
235
236
237
238
239
240
241
# File 'lib/opal/drb/websocket.rb', line 234

def recv_request
  begin
    @msg.recv_request(@req_stream)
  rescue
    close
    raise $!
  end
end

#send_reply(succ, result) ⇒ Object



243
244
245
246
247
248
249
250
251
252
# File 'lib/opal/drb/websocket.rb', line 243

def send_reply(succ, result)
  begin
    stream = StrStream.new
    @msg.send_reply(stream, succ, result)
    @reply = stream.buf
  rescue
    close
    raise $!
  end
end