loopback-component-socketio-emit
SocketIO emitter for loopback
Last updated 3 years ago by reseta .
MIT · Original npm · Tarball · package.json
$ cnpm install loopback-component-socketio-emit 
SYNC missed versions from official npm registry.

LoopBack Component SocketIO Emit

A LoopBack Framework Component that provides firing loopback events over SocketIO.

Installation

$ npm install --save loopback-component-socketio-emit

Setup Back End Module

Update the server/component-config.json as follows:

{
  "loopback-component-socketio-emit": {
    "auth": true,
    "debug": false,
    "socketOn": "ME:RT:1://event",
    "startWith": "eventEmitter:"
  }
}

"startWith" ending with colon is required

Client example

IO.emit('eventEmitter:eventName', {});

Backend example

MyModel.on('attached', () => {
    MyModel.app.on('eventName', (data) => {
      MyModel.app.io.emit('event', {status: 'SUCCESS', data: data});
    });
  });

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |