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

1.2.8 • Public • Published

@weirdscience/cybercafe-client

Cybercafe-client is a library designed to connect and interact with the cybercafe-server, providing a seamless experience for managing virtual room interactions in real-time.

Features

  • Connect to and interact with different room namespaces.
  • Send and receive real-time events.
  • Manage connection state and handle disconnections gracefully.

Installation

npm install @weirdscience/cybercafe-client

Usage

To get started with cybercafe-client, you need to import the CybercafeClient class.

import { CybercafeClient } from "@weirdscience/cybercafe-client";

Create an instance of CybercafeClient:

const client = new CybercafeClient("http://localhost:3000");

Connect to a room namespace:

client.connect("chat");

Listen for events:

client.on("message", (data) => {
  console.log("Received message:", data);
});

Send an event:

client.emit("message", { text: "Hello, world!" });

Disconnect from the server:

client.disconnect();

Building

Build the package with:

npm run build

Linting

Lint the codebase with:

npm run lint

Changelog

Refer to the CHANGELOG.md for detailed information about changes in each version.

License

This project is licensed under the MIT License - see the LICENSE file for details.

/@weirdscience/cybercafe-client/

    Package Sidebar

    Install

    npm i @weirdscience/cybercafe-client

    Weekly Downloads

    2

    Version

    1.2.8

    License

    none

    Unpacked Size

    14.5 kB

    Total Files

    15

    Last publish

    Collaborators

    • mikexrmn