New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cycoder-server

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycoder-server

Socket server with storage redis or nats

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

System Requirements

The following are required to function properly.

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

The system used

  • Fastify 3.9+ see: https://www.fastify.io/docs/latest/
  • Socket IO 3.0+ see: https://socket.io/docs/v3/server-api/index.html

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')

Keywords

Websocket

FAQs

Package last updated on 26 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts