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

2.0.22 • Public • Published

Causal Tree Client Socket.io

npm (scoped)

A connection transport for a CausalRepoClient that uses socket.io to communicate with a SocketIOConnectionServer from @casual-simulation/causal-tree-server-socketio.

Usage

Connect to a server

import {
    SocketManager,
    SocketIOConnectionClient,
} from '@casual-simulation/causal-tree-client-socketio';

demo();

async function demo() {
    const manager = new SocketManager('https://example.com');
    const connection = new SocketIOConnectionClient(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-socketio

Weekly Downloads

5

Version

2.0.22

License

MIT

Unpacked Size

15.1 kB

Total Files

15

Last publish

Collaborators

  • kallyngowdyyeti
  • casualsimulation