@casual-simulation/causal-tree-client-websocket
TypeScript icon, indicating that this package has built-in type declarations

3.2.1-alpha.5649263218 • Public • Published

Causal Tree Client WebSocket

npm (scoped)

A connection transport for a CausalRepoClient that uses raw websockets to communicate with a WebSocketConnectionServer from @casual-simulation/causal-tree-server-websocket.

Usage

Connect to a server

import { SocketManager } from '@casual-simulation/websocket';
import { WebSocketConnectionClient } from '@casual-simulation/causal-tree-client-websocket';

demo();

async function demo() {
    const manager = new SocketManager('https://example.com');
    const connection = new WebSocketConnectionClient(manager.socket, {
        id: 'device-id',
        username: 'username',
        token: 'token',
    });

    manager.init();
    connection.connect();

    // TODO: Do things with the connection
}

Package Sidebar

Install

npm i @casual-simulation/causal-tree-client-websocket

Weekly Downloads

3

Version

3.2.1-alpha.5649263218

License

MIT

Unpacked Size

9.91 kB

Total Files

9

Last publish

Collaborators

  • kallyngowdyyeti
  • casualsimulation