@lovetap/websocket-client
TypeScript icon, indicating that this package has built-in type declarations

2.1.1 • Public • Published

@lovetap/websocket-client

CI

The official Lovetap WebSocket API client. This is a low-level client that is used by the Lovetap SDKs. There are definitely easier ways to connect to Lovetap, such as the vanilla JS SDK, but you are welcome to use this library directly.

Installation

npm install @lovetap/websocket-client

Usage

Connections to the Lovetap WebSocket API are authenticated using an API key. You can find your API keys on the My Account page.

import { LovetapWebSocketClient } from "@lovetap/websocket-client";

const client = new LovetapWebSocketClient();

// For verbose logging, you can use `new LovetapWebSocketClient({logLevel: "debug"})`

await client.connect({
  apiKey: "YOUR_API_KEY",
  onServerMessage: (message) => console.log(message),
});

client.visit("my-page-key");

client.react("my-page-key", "👍");

client.leave("my-page-key");

setTimeout(() => {
  client.disconnect();
}, 1000);

© 2023 Lovetap LLC

Readme

Keywords

none

Package Sidebar

Install

npm i @lovetap/websocket-client

Weekly Downloads

1

Version

2.1.1

License

MIT

Unpacked Size

146 kB

Total Files

42

Last publish

Collaborators

  • dmsltfm