cycoder-server
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

System Requirements

The following are required to function properly.

  • Node 10.0+
  • Redis 4.0+
  • Nats 2.0+

The system used

Installation

$ npm install cycoder-server

How to use

The following example attaches socket.io to a plain Node.JS HTTP server listening on port 3000

Simply code:

const ecosystem = require('cycoder-server').createServer({
    app: {
        id: '...', // set with uuid v4
        secret: '...'
    }
});

ecosystem.listen(3000);

Custom channel

Simply code:

ecosystem.channel({
    join: (socket, channel) => {},
    leave: (socket, channel, reason) => {}
});

How to server SocketIO and HTTP

Simply code:

echosystem.listen(3000).then(({ io, http }) => {
    // Code here
});

Or

const { io, http } = echosystem.listen(3000);

Multiple namespaces

Simply code:

ecosystem.of(/^\/dynamic-\d+$/)

Or

ecosystem.of('/dynamic-101')

/cycoder-server/

    Package Sidebar

    Install

    npm i cycoder-server

    Weekly Downloads

    1

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    67 kB

    Total Files

    50

    Last publish

    Collaborators

    • reynaldiaznan