@aceonics/loopback-component-realtime
The LoopBack Component that turns this great framework into a powerful real-time platform
Last updated 2 years ago by jeetchaudhari .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @aceonics/loopback-component-realtime 
SYNC missed versions from official npm registry.

LoopBack Component Real-Time

A Loopback Component Realtime is a Loopback Framework component that provides publish events over WebSockets, originally forked from mean-expert-official/loopback-component-realtime.

Installation

$ npm install --save @aceonics/{loopback-sdk-builder,loopback-component-realtime}

Setup Back End Module

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

{
  "loopback-component-explorer": {
    "mountPath": "/explorer"
  },
  "@aceonics/loopback-component-realtime": {
    "debug": true,
    "auth": true,
    "driver": {
      "name": "socket.io"
    }
  }
}

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

{
  "mixins": [
    "loopback/common/mixins",
    "loopback/server/mixins",
    "../common/mixins",
    "./mixins",
    "../node_modules/@aceonics/loopback-component-realtime/dist/mixins"
  ]
}

Enable Model to use FireLoop API

NOTE: Due a LoopBack limitation the server triggered events are only available for root model methods (Model.create()), but it won't work for relationship methods, these will continue being executed only from FireLoop Child References in the Front-End

{
  "mixins": {
    "FireLoop": true
  }
}

Update Server

To propagate the App from LoopBack to FireLoop, so to finalize just update the file server/server.js by editing the app.start method as follow:

app.start = function() {
  // start the web server
  var server = app.listen(function() {
    app.emit('started', server);
    var baseUrl = app.get('url').replace(/\/$/, '');
    console.log('Web server listening at: %s', baseUrl);
    if (app.get('loopback-component-explorer')) {
      var explorerPath = app.get('loopback-component-explorer').mountPath;
      console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
    }
  });
  return server;
};

License

Copyright (c) Aceonics Reliable IT Services. All rights reserved.

Licensed under the MIT License.

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

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

Copyright 2014 - 2016 © taobao.org |