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

1.2.8 • Public • Published

@weirdscience/cybercafe-server

Cybercafe-server is a foundational library for creating and managing virtual rooms within a server environment, utilizing socket.io for real-time communication.

Features

  • Define and manage custom room types.
  • Create, retrieve, and remove rooms dynamically.
  • Extend room functionality with custom state management and event handling.

Installation

npm install @weirdscience/cybercafe-server

Usage

To get started with cybercafe-server, you need to import the CyberCafeServer and Room classes.

import { CyberCafeServer, Room } from "@weirdscience/cybercafe-server";

Create an instance of CyberCafeServer:

const server = new CyberCafeServer<string>();

Define a new room type:

server.defineRoomType({
  type: "chat",
  constructor: Room, // Replace with your custom room class if needed
});

Create a new room:

const chatRoom = server.createRoom("chat", "room1");

Retrieve a room by its ID:

const room = server.getRoom("room1");

Remove a room by its ID:

server.removeRoom("room1");

Testing

Run the test suite using the following command:

npm test

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @weirdscience/cybercafe-server

Weekly Downloads

0

Version

1.2.8

License

none

Unpacked Size

32.5 kB

Total Files

20

Last publish

Collaborators

  • mikexrmn