watson_developer_cloud.websocket.speech_to_text_websocket_listener module

class RecognizeListener(audio, options, recognize_callback, url, headers)[source]

Bases: object

class WebSocketClient(factory, audio, options, callback)[source]

Bases: autobahn.twisted.websocket.WebSocketClientProtocol

build_start_message(options)[source]
build_close_message()[source]
send_audio(data)[source]
extract_transcripts(alternatives)[source]
onConnect(response)[source]

Callback fired directly after WebSocket opening handshake when new WebSocket server connection was established.

Parameters:response (instance of autobahn.websocket.protocol.ConnectionResponse) – WebSocket connection response information.
onOpen()[source]

Implements autobahn.websocket.interfaces.IWebSocketChannel.onOpen

onMessage(payload, isBinary)[source]

Implements autobahn.websocket.interfaces.IWebSocketChannel.onMessage

onClose(wasClean, code, reason)[source]

Implements autobahn.websocket.interfaces.IWebSocketChannel.onClose

class WebSocketClientFactory(audio, options, callback, url=None, headers=None)[source]

Bases: autobahn.twisted.websocket.WebSocketClientFactory

endReactor()[source]
buildProtocol(addr)[source]

Create an instance of a subclass of Protocol.

The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.

Alternatively, L{None} may be returned to immediately close the new connection.

Override this method to alter how Protocol instances get created.

@param addr: an object implementing L{twisted.internet.interfaces.IAddress}