Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ataraxia-ws-client

WebSocket client-side transport that joins a Network by connecting to a websocket server.

import { Network, AnonymousAuth } from 'ataraxia';
import { WebSocketClientTransport } from 'ataraxia-ws-client';

// Setup a network with a WebSocket client
const net = new Network({
name: 'name-of-your-app-or-network',
transports: [
new WebSocketClientTransport({
// URL to the websocket on the server
url: 'ws://localhost:7000',
// If using outside a browser, define how a WebSocket is created
factory: url => new WebSocket(url),
// Use anonymous authentication
authentication: [
new AnonymousAuth()
]
})
]
});

await net.join();

Index

Type aliases

WebSocketFactory

WebSocketFactory: (url: string) => WebSocket

Type declaration

Generated using TypeDoc