Connection

Tinode. Connection

new Connection(host_, apiKey_, transport_, secure_, autoreconnect_)

An abstraction for a websocket or a long polling connection.
Source:
Parameters:
Name Type Description
host_ string Host name and port number to connect to.
apiKey_ string API key generated by keygen
transport_ string Network transport to use, either `ws`/`wss` for websocket or `lp` for long polling.
secure_ boolean Use secure WebSocket (wss) if true.
autoreconnect_ boolean If connection is lost, try to reconnect automatically.

Type Definitions

AutoreconnectIterationType(timeout, promise)

A callback to notify of reconnection attempts. See Tinode.Connection#onAutoreconnectIteration.
Source:
Parameters:
Name Type Description
timeout string time till the next reconnect attempt in milliseconds. -1 means reconnect was skipped.
promise Promise resolved or rejected when the reconnect attemp completes.

LoggerCallbackType(event)

A callback to log events from Connection. See Tinode.Connection#logger.
Source:
Parameters:
Name Type Description
event string Event to log.

OnMessage(message)

A callback to pass incoming messages to. See Tinode.Connection#onMessage.
Source:
Parameters:
Name Type Description
message string Message to process.