@bobfrankston/iflow 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as net from "node:net";
|
|
6
6
|
import * as tls from "node:tls";
|
|
7
|
+
import { StringDecoder } from "node:string_decoder";
|
|
7
8
|
export class NodeTransport {
|
|
8
9
|
socket = null;
|
|
10
|
+
decoder = new StringDecoder("utf-8");
|
|
9
11
|
dataHandler = null;
|
|
10
12
|
closeHandler = null;
|
|
11
13
|
errorHandler = null;
|
|
@@ -40,7 +42,7 @@ export class NodeTransport {
|
|
|
40
42
|
// Wire up persistent handlers after connect
|
|
41
43
|
this.socket.on("data", (chunk) => {
|
|
42
44
|
if (this.dataHandler)
|
|
43
|
-
this.dataHandler(
|
|
45
|
+
this.dataHandler(this.decoder.write(chunk));
|
|
44
46
|
});
|
|
45
47
|
this.socket.on("close", (hadError) => {
|
|
46
48
|
this._connected = false;
|
|
@@ -64,10 +66,11 @@ export class NodeTransport {
|
|
|
64
66
|
rejectUnauthorized: this.rejectUnauthorized,
|
|
65
67
|
}, () => {
|
|
66
68
|
this.socket = tlsSocket;
|
|
69
|
+
this.decoder = new StringDecoder("utf-8");
|
|
67
70
|
// Re-wire data handler to new socket
|
|
68
71
|
tlsSocket.on("data", (chunk) => {
|
|
69
72
|
if (this.dataHandler)
|
|
70
|
-
this.dataHandler(
|
|
73
|
+
this.dataHandler(this.decoder.write(chunk));
|
|
71
74
|
});
|
|
72
75
|
tlsSocket.on("close", (hadError) => {
|
|
73
76
|
this._connected = false;
|