Class: DripDrop::WebSocketHandler::Connection

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/dripdrop/handlers/websockets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseHandler

#handle_error, #on_error, #print_exception

Constructor Details

#initialize(ws) ⇒ Connection

Returns a new instance of Connection.



69
70
71
72
# File 'lib/dripdrop/handlers/websockets.rb', line 69

def initialize(ws)
  @ws = ws
  @signature = @ws.signature
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



67
68
69
# File 'lib/dripdrop/handlers/websockets.rb', line 67

def handler
  @handler
end

#signatureObject (readonly)

Returns the value of attribute signature.



67
68
69
# File 'lib/dripdrop/handlers/websockets.rb', line 67

def signature
  @signature
end

#wsObject (readonly)

Returns the value of attribute ws.



67
68
69
# File 'lib/dripdrop/handlers/websockets.rb', line 67

def ws
  @ws
end

Instance Method Details

#send_message(message) ⇒ Object



74
75
76
77
# File 'lib/dripdrop/handlers/websockets.rb', line 74

def send_message(message)
  encoded_message = dd_messagify(message).encoded
  @ws.send(encoded_message)
end