Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 839 Bytes

README.md

File metadata and controls

35 lines (24 loc) · 839 Bytes

leap-edge-js

Utility library for connecting and receiving events from Leap Edge. Used for Channels.

Usage

Connecting

import {LeapEdgeClient} from 'leap-edge-js';

const projectId = 'project_xxx';
const token = 'leap_token_xxx';

const leap = new LeapEdgeClient({projectId, token});
leap.connect();

If you don't want to supply a token (e.g. to only connect to unprotected channels), then just don't include the token in the authentication parameters object

Listening for Connection Status Updates

leap.on('connectionStatusUpdate', (status: LeapConnectionStatus) => {
	// do something with status
});

Listening for Service Events

leap.on('serviceEvent', ({channelId, eventType, data}: LeapServiceEvent) => {
	// do something
});