Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 86a822f

Browse files
committed
socket emit with _ evants and index as table name
1 parent c9b391d commit 86a822f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

service/src/services/dflowzdata/dflowzdata.class.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@ const createServiceMain = require('feathers-rethinkdb');
55
class Service {
66
constructor (options) {
77
this.options = options || {};
8+
this.events = ['_created','_updated','_patched','_removed'];
89
this.service = new createServiceMain(options);
910
this.rDB = this.service.options.r.db(this.service.options.db);
1011
}
1112

1213
setup(app) {
1314
this.app = app;
15+
const _thisApp = app
1416
// this.service.watchChangefeeds(app);
1517
this.on('created',(data) => {
16-
this.app.io.emit(this.service.options.name+'_created', data);
18+
this.app.service('dflowzdata').emit('_created',{[this.service.options.name]:data});
1719
});
1820
this.on('updated',(data) => {
19-
this.app.io.emit(this.service.options.name+'_updated', data);
21+
this.app.service('dflowzdata').emit('_updated', {[this.service.options.name]:data});
2022
});
2123
this.on('patched',(data) => {
22-
this.app.io.emit(this.service.options.name+'_patched', data);
24+
this.app.service('dflowzdata').emit('_patched', {[this.service.options.name]:data});
2325
});
2426
this.on('removed',(data) => {
25-
this.app.io.emit(this.service.options.name+'_removed', data);
27+
this.app.service('dflowzdata').emit('_removed', {[this.service.options.name]:data});
2628
});
2729
}
2830
setTableName (params) {

0 commit comments

Comments
 (0)