Variable WebSocketTransportConst

WebSocketTransport: unknown

Provides a BaseRealtime instance with the ability to establish a connection with the Ably realtime service using a WebSocket connection.

To create a client that includes this plugin, include it in the client options that you pass to the constructor:

import { BaseRealtime, WebSocketTransport, FetchRequest } from 'ably/modular';
const realtime = new BaseRealtime({ ...options, plugins: { WebSocketTransport, FetchRequest } });

Note that network conditions, such as firewalls or proxies, might prevent the client from establishing a WebSocket connection. For this reason, you may wish to provide the BaseRealtime instance with the ability to alternatively establish a connection using long polling which is less susceptible to these external conditions. You do this by passing in the XHRPolling plugin, alongside WebSocketTransport:

import { BaseRealtime, WebSocketTransport, FetchRequest } from 'ably/modular';
const realtime = new BaseRealtime({ ...options, plugins: { WebSocketTransport, XHRPolling, FetchRequest } });

Generated using TypeDoc