Class: OpenTok::WebSocket

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ WebSocket



33
34
35
# File 'lib/opentok/websocket.rb', line 33

def initialize(client)
  @client = client
end

Instance Method Details

#connect(session_id, token, websocket_uri, opts = {}) ⇒ Object

Starts an Audio Connector WebSocket connection to send audio from a Vonage Video API session to a WebSocket URI. See the / OpenTok Audio Connector developer guide.

Examples:

opts = {
  "streams" => ["STREAMID1", "STREAMID2"],
  "headers" => {
    "key1" => "val1",
    "key2" => "val2"
  }
}
response = opentok.websocket.connect(SESSIONID, TOKEN, "ws://service.com/wsendpoint", opts)

Options Hash (opts):

  • :streams (Array) — default: optional

    An array of stream IDs for the OpenTok streams you want to include in the WebSocket stream. If you omit this property, all streams in the session will be included.

  • :headers (Hash) — default: optional

    A hash of key-value pairs of headers to be sent to your WebSocket server with each message, with a maximum length of 512 bytes.



29
30
31
# File 'lib/opentok/websocket.rb', line 29

def connect(session_id, token, websocket_uri, opts  = {})
  response = @client.connect_websocket(session_id, token, websocket_uri, opts)
end