Skip to content

Commit

Permalink
minor change to improve performance onMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Jan 12, 2022
1 parent 887bb2b commit 7ed58ad
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/connectors/connectorRIS.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,21 @@ export default class ConnectorRIS extends Connector {
}
};

_messageToJsonCanary = (message) => {
this._checkCanary();
this._message(JSON.parse(message));
};

_messageToJson = (message) => {
const messageObj = JSON.parse(message);
if (this._shouldCanaryMonitoringStart()) {
this._checkCanary();
}
this._message(messageObj);
this._message(JSON.parse(message));
};

_appendListeners = (resolve, reject) => {
this.ws.on('message', this._messageToJson);
if (this._shouldCanaryMonitoringStart()) {
this.ws.on('message', this._messageToJsonCanary);
} else {
this.ws.on('message', this._messageToJson);
}
this.ws.on('close', (error) => {

if (this.connected) {
Expand Down

0 comments on commit 7ed58ad

Please sign in to comment.