0.3.2 • Published 7 years ago

@terrajs/mono-push v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

MonoPush module for Mono

npm version Travis Coverage license

Installation

npm install --save @terrajs/mono-push

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

module.exports = {
  mono: {
    modules: [
      '@terrajs/mono-mongodb',
      '@terrajs/mono-push'
    ]
  }
}

mono-push requires mono-mongodb, so it must be installed and declared before mono-push because modules are loaded synchronously

Configuration

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

module.exports = {
  mono: {
    push: {
      io: true
    }
  }
}

When using io: true, mono-push requires mono-io, so it must be installed and declared (example: conf/application.js):

module.exports = {
  mono: {
    modules: [
      '@terrajs/mono-mongodb',
      '@terrajs/mono-io',
      '@terrajs/mono-push'
    ]
  }
}

Usage

In your modules files, you can access send helper like this:

send(event: string, query: object = {}, payload: object = {})

Example:

const { send } = require('@terrajs/mono-push')

await send('new-push', { userId: '...' }, { message: 'Welcome!' })

With conf io: true, mono-push will emit an event to every socket connected that matches the query

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago