@casual-simulation/causal-tree-client-websocket
v3.2.1-alpha.5649263218
Published
A set of services that can be used to network with @casual-simulation/causal-tree-server-websocket
Downloads
64
Readme
Causal Tree Client WebSocket
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
}