ibm_watson.websocket.synthesize_listener module

class SynthesizeListener(options, callback, url, headers, http_proxy_host=None, http_proxy_port=None, verify=None)[source]

Bases: object

send_text()[source]

Sends the text message Note: The service handles one request per connection

on_open(ws)[source]

Callback executed when a connection is opened to the server. Handles sending text to server

Parameters

ws – Websocket client

on_data(ws, message, message_type, fin)[source]

Callback executed when message is received from the server.

Parameters
  • ws – Websocket client

  • message – utf-8 string which we get from the server.

  • message_type – Message type which is either ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY

  • fin – continue flag. If 0, the data continues.

on_error(ws, error)[source]

Callback executed when an error is received

Parameters
  • ws – Websocket client

  • error – Exception object

on_close(ws, **kwargs)[source]

Callback executed when websocket connection is closed

Parameters

ws – Websocket client