From 312a34dff833b67f7c09fd6332f4c81734f48894 Mon Sep 17 00:00:00 2001 From: imhype <543717080@qq.com> Date: Tue, 27 Nov 2018 16:03:31 +0800 Subject: [PATCH] fix#6: remove response event --- lib/core/follower.js | 14 -------------- lib/core/k-agent.js | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/core/follower.js b/lib/core/follower.js index 344f50c..cbdea57 100644 --- a/lib/core/follower.js +++ b/lib/core/follower.js @@ -28,20 +28,6 @@ module.exports = class Follower extends Base { await this.client.ready(); await this.connectWithRetry(); - this.client.on('response', (response) => { - const data = JSON.parse(response.data.toString()); - const actions = ['connected']; - let action; - - if (actions.includes(data.action)) { - action = data.action; - } else { - action = 'message'; - } - - this.emit(action, data); - }); - this.client.on('request', (response) => { const data = JSON.parse(response.data.toString()); const actions = ['excution', 'syncState']; diff --git a/lib/core/k-agent.js b/lib/core/k-agent.js index b0751a6..9c4771c 100644 --- a/lib/core/k-agent.js +++ b/lib/core/k-agent.js @@ -15,6 +15,6 @@ module.exports = class Client extends Base { async _init() { this.client.on('syncState', ({data}) => { this.state = data; - }) + }); } } \ No newline at end of file