mirror of
https://github.com/yldio/copilot.git
synced 2024-12-26 03:40:04 +02:00
8295bd6882
this shall be a progressive process
19 lines
423 B
JavaScript
19 lines
423 B
JavaScript
const Metric = require('../metric');
|
|
|
|
module.exports = (server) => {
|
|
const metric = Metric(server);
|
|
|
|
server.subscription('/stats/{id}', {
|
|
onSubscribe: (socket, path, params, next) => {
|
|
console.log('onSubscribe');
|
|
metric.on(params.id);
|
|
next();
|
|
},
|
|
onUnsubscribe: (socket, path, params, next) => {
|
|
console.log('onUnsubscribe');
|
|
metric.off(params.id);
|
|
next();
|
|
}
|
|
});
|
|
};
|