liquid-tap0.1.4 • Public • Published
A simple wrapper around the PusherJS Client to enable connecting to the tap.liquid.com server and facilitate user authentication.
To manage API tokens, refer to: https://app.liquid.com/settings/api-tokens
To learn more about Liquid Api token management, see the help links below: https://help.liquid.com/connect-to-liquid-via-api
Install via npm or yarn:
npm install liquid-tap yarn add liquid-tap
OR Include the library:
If PusherJS is already included on the page, then only include the extension version of LiquidTap:
The library can be used in the same fashion as Pusher:
;const tap = ;const public_channel = tap;public_channel;
To subscribe to protected channels, the client must provide a token_id and token_secret which has permission to view those channels.
Authenticate on Initialization
var tap = token_id token_secret;// Refer to profile page for user_id:var protected_channel = tap;protected_channel;
Authenticate after Initialization
The library allows the LiquidTap client to be created and subscribe to public channels, then when a protected channel is required the client can authenticate.
var tap = ;var public_channel = tap;public_channel;tap;var protected_channel = tap;protected_channel;
Binding to events
var tap = token_id token_secret;tap;tap;tap;
If for somereason the underlying PusherJS client needs to be accessed, it can be accessed through
var tap = ;tappusherconnection;
However this is not recommended as the library needs to ensure the order of some events so if a task needs to happen after the connected event, then it is better to use the provided interface:
tap.bind('connected', ... )
Open the chrome dev tools and inspect the network traffic as shown in the image below:
npm run sample npm run dev
npm run test
Ensure changes are also thoroughly tested with the real world server responses.
npm run build
Ensure to commit compiled assets in