@@ -45,8 +45,6 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
45
45
private _timeoutMsecs ;
46
46
/** @type {number | undefined } @private */
47
47
private _timeout ;
48
- /** @type {number } @private */
49
- private _state ;
50
48
/** @private */
51
49
private _encoding ;
52
50
/** @private */
@@ -61,17 +59,34 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
61
59
private _resuming ;
62
60
/** @private */
63
61
private _writeBufferSize ;
62
+ /** @private */
63
+ private _bytesRead ;
64
+ /** @private */
65
+ private _bytesWritten ;
66
+ /** @private */
67
+ private _connecting ;
68
+ /** @private */
69
+ private _pending ;
70
+ /** @private */
71
+ private _destroyed ;
72
+ /** @type {'opening' | 'open' | 'readOnly' | 'writeOnly' } @private */
73
+ private _readyState ;
64
74
/** @type {{ id: number; data: string; }[] } @private */
65
75
private _pausedDataEvents ;
66
76
readableHighWaterMark : number ;
67
77
writableHighWaterMark : number ;
68
78
writableNeedDrain : boolean ;
69
- bytesSent : number ;
70
79
localAddress : string | undefined ;
71
80
localPort : number | undefined ;
72
81
remoteAddress : string | undefined ;
73
82
remotePort : number | undefined ;
74
83
remoteFamily : string | undefined ;
84
+ get readyState ( ) : "opening" | "open" | "readOnly" | "writeOnly" ;
85
+ get destroyed ( ) : boolean ;
86
+ get pending ( ) : boolean ;
87
+ get connecting ( ) : boolean ;
88
+ get bytesWritten ( ) : number ;
89
+ get bytesRead ( ) : number ;
75
90
get timeout ( ) : number | undefined ;
76
91
/**
77
92
* @package
@@ -88,7 +103,6 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
88
103
* @param {() => void } [callback]
89
104
*/
90
105
connect ( options : ConnectionOptions , callback ?: ( ( ) => void ) | undefined ) : Socket ;
91
- _destroyed : boolean | undefined ;
92
106
/**
93
107
* Sets the socket to timeout after `timeout` milliseconds of inactivity on the socket. By default `TcpSocket` do not have a timeout.
94
108
*
@@ -152,8 +166,8 @@ export default class Socket extends EventEmitter<SocketEvents & ReadableEvents,
152
166
* @param {string | Buffer | Uint8Array } data
153
167
* @param {BufferEncoding } [encoding]
154
168
*/
155
- end ( data : string | Buffer | Uint8Array , encoding ?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined ) : void ;
156
- destroy ( ) : void ;
169
+ end ( data : string | Buffer | Uint8Array , encoding ?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined ) : Socket ;
170
+ destroy ( ) : Socket ;
157
171
/**
158
172
* Sends data on the socket. The second parameter specifies the encoding in the case of a string — it defaults to UTF8 encoding.
159
173
*
0 commit comments