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.



125
126
127
128
129
130
# File 'lib/opal/drb/websocket.rb', line 125

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.



123
124
125
# File 'lib/opal/drb/websocket.rb', line 123

def reply
  @reply
end

#uriObject (readonly)

Returns the value of attribute uri.



123
124
125
# File 'lib/opal/drb/websocket.rb', line 123

def uri
  @uri
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


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

def alive?; false; end

#closeObject



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

def close
end

#recv_requestObject



137
138
139
140
141
142
143
144
# File 'lib/opal/drb/websocket.rb', line 137

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

#send_reply(succ, result) ⇒ Object



146
147
148
149
150
151
152
153
154
155
# File 'lib/opal/drb/websocket.rb', line 146

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