@3kles/3kles-socketio
TypeScript icon, indicating that this package has built-in type declarations

2.1.7 • Public • Published

@3kles/3kles-socketio

This package contains class to create sockets

Models

IGenericMessage is a model to represent the message exchanged

  • type?: string: Type of the message
  • to?: string: Specify to who you want to send the message
  • room?: string: Specific room where to send to the message
  • content: any: Content of the message

Interfaces

IGenericSocket is a generic socket interface

  • start(): Promise<void>: To initialize the connections
  • getUsers(): Map<string, any>: To get the users connected
  • addListener(listener?: { event: string, listener: (...args: any[]) => void }): void: To add a listener

Install

npm

npm install @3kles/3kles-socketio --save

How to use

How to create a socket

const broker = await MessageBroker.getInstance();

const app = new GenericApp();
const server = app.startApp();
const genericSocket = new GenericSocket(broker, server);
await genericSocket.start();

Check the documentation here.

Dependents (0)

Package Sidebar

Install

npm i @3kles/3kles-socketio

Weekly Downloads

15

Version

2.1.7

License

ISC

Unpacked Size

630 kB

Total Files

15

Last publish

Collaborators

  • freazgo
  • jchaut
  • cdasilvacosta
  • qcampos