Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mean-expert-official/loopback-component-realtime
The LoopBack Component that turns this great framework into a powerful real-time platform
https://github.com/mean-expert-official/loopback-component-realtime
Last synced: about 1 month ago
JSON representation
The LoopBack Component that turns this great framework into a powerful real-time platform
- Host: GitHub
- URL: https://github.com/mean-expert-official/loopback-component-realtime
- Owner: mean-expert-official
- License: mit
- Created: 2016-09-21T22:24:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-06T15:18:18.000Z (about 1 year ago)
- Last Synced: 2024-11-08T13:16:27.074Z (about 2 months ago)
- Language: TypeScript
- Size: 178 KB
- Stars: 30
- Watchers: 6
- Forks: 17
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# LoopBack Component Real-Time
A [LoopBack Framework](http://loopback.io) Component that provides publish events over WebSockets.
This module will supersedes the [LoopBack Component PubSub](https://github.com/mean-expert-official/loopback-component-pubsub) and implements the new [FireLoop Module](http://fireloop.io).
# Installation
````sh
$ npm install --save @mean-expert/{loopback-sdk-builder,loopback-component-realtime}
````# Setup Back End Module
Update the `server/component-config.json` as follows:
````json
{
"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:
````json
{
"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`
````json
{
"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:````js
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](https://storage.googleapis.com/mean-expert-images/fireloop-logo.png)](https://github.com/mean-expert-official/fireloop.io/wiki)# Generate FireLoop Angular 2 Client
FireLoop Client for Angular 2 Applications are built in when generating your LoopBack SDK. Read the [Following Instructions](https://github.com/mean-expert-official/loopback-sdk-builder/wiki/1.-Install-Builder-&-Build-SDK) in order to automatically generate your software development kit.