Coder Social home page Coder Social logo

namelessichi / loopback-component-realtime Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mean-expert-official/loopback-component-realtime

0.0 1.0 0.0 173 KB

The LoopBack Component that turns this great framework into a powerful real-time platform

License: MIT License

JavaScript 2.87% TypeScript 95.75% HTML 1.37%

loopback-component-realtime's Introduction

LoopBack Component Real-Time

A LoopBack Framework Component that provides publish events over WebSockets.

This module will supersedes the LoopBack Component PubSub and implements the new FireLoop Module.

Installation

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

Setup Back End Module

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

{
  "loopback-component-explorer": {
    "mountPath": "/explorer"
  },
  "@mean-expert/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/@mean-expert/loopback-component-realtime/dist/mixins"
    ]
}

Enable Model to use FireLoop API

From version 1.0.0-rc.8 you need to specify in which models you want to enable FireLoop events to be sent.

Explanation: In an attempt to enable server and rest triggered events a new mixin has been introduced, this will trigger events either from REST calls or from the NodeJS Api e.g. Model.create().

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;
};

PRESENTING FIRELOOP.IO (NEW)

FireLoop.io

Generate FireLoop Angular 2 Client

FireLoop Client for Angular 2 Applications are built in when generating your LoopBack SDK. Read the Following Instructions in order to automatically generate your software development kit.

loopback-component-realtime's People

Contributors

jonathan-casarrubias avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.