From ba8301cda0e049c17feecdf18666ed41617e1ad5 Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Fri, 17 Feb 2017 07:15:34 +0100 Subject: [PATCH] Allow the use of a custom parser See https://github.com/socketio/socket.io/pull/2829 --- lib/manager.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/manager.js b/lib/manager.js index b08482a84..fc56a7d35 100644 --- a/lib/manager.js +++ b/lib/manager.js @@ -62,8 +62,9 @@ function Manager (uri, opts) { this.lastPing = null; this.encoding = false; this.packetBuffer = []; - this.encoder = new parser.Encoder(); - this.decoder = new parser.Decoder(); + var _parser = opts.parser || parser; + this.encoder = new _parser.Encoder(); + this.decoder = new _parser.Decoder(); this.autoConnect = opts.autoConnect !== false; if (this.autoConnect) this.open(); }