Causal Tree Client Socket.io
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
}