Skip to content

mono-js/mono-io

Repository files navigation

Mono

Socket.io module for Mono

npm version Travis Coverage license

Mono-io uses socket.io and socketio-jwt to handle sockets with authorization via JWT.

Installation

npm install --save mono-io

Then, in your configuration file of your Mono application (example: conf/application.js):

module.exports = {
  mono: {
    modules: ['mono-io']
  }
}

Configuration

mono-io will use the io property of your configuration (example: conf/development.js):

module.exports = {
  mono: {
    io: {
      // See options here: https://github.com/socketio/socket.io/blob/master/docs/API.md#new-serverhttpserver-options
    }
  }
}

Usage

In your modules files, you can access io instance:

const { io } = require('mono-io')

io.on('connection', function (socket) {
  console.log(socket)
})