diff --git a/main.js b/main.js index 9a0ec38..3413ea4 100644 --- a/main.js +++ b/main.js @@ -36,7 +36,7 @@ class Client { this.socket = tls.connect({ host: this.host, port: this.port }, () => { this.socket.write("Authentication: " + Buffer.from( this.username + "\\0" + this.password).toString('base64') +"\r\n"); - this.socket.on('data', function (data) { + this.socket.once('data', function (data) { if (data.toString().startsWith("0")) { resolve("Connected to CursusDB cluster successfully.") } else { @@ -48,7 +48,7 @@ class Client { this.socket = net.createConnection({ host: this.host, port: this.port }, () => { this.socket.write("Authentication: " + Buffer.from( this.username + "\\0" + this.password).toString('base64') +"\r\n"); - this.socket.on('data', function (data) { + this.socket.once('data', function (data) { if (data.toString().startsWith("0")) { resolve("Connected to CursusDB cluster successfully.") } else { @@ -65,7 +65,7 @@ class Client { return new Promise((resolve, reject) => { this.socket.write(queryString +"\r\n"); - this.socket.on('data', function (data) { + this.socket.once('data', function (data) { resolve(data.toString()) }); diff --git a/package.json b/package.json index bd1388e..1beda46 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cursusdb-node", - "version": "1.0.1", + "version": "1.0.2", "description": "CursusDB NodeJS native client.", "main": "main.js", "type": "module",