@terrajs/mono-io
v1.1.2
Published
IO module for Mono
Downloads
7
Readme
Socket.io module for Mono
Mono-io uses socket.io and socketio-jwt to handle sockets with authorization via JWT.
Installation
npm install --save @terrajs/mono-io
Then, in your configuration file of your Mono application (example: conf/application.js
):
module.exports = {
mono: {
modules: ['@terrajs/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('@terrajs/mono-io')
io.on('connection', function (socket) {
console.log(socket)
})