forked from bitfocus/companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
telnet.d.ts
40 lines (35 loc) · 1.06 KB
/
telnet.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/// <reference types="node" />
import { EventEmitter } from 'events'
/**
* A Telnet client wrapper
* Events emitted:
* - 'error' when an error occurs
* - 'status_change' when the connection status changes. Valid values are STATUS_OK, STATUS_WARNING and STATUS_ERROR (as found on instance_skel)
* - 'connect' when the connection has opened
* - 'end' when the socket has ended
* - 'iac'
* - 'sb'
* - 'data' when a packet of data has been received
* - 'drain' when the write buffer has emptied
*/
declare class Telnet extends EventEmitter {
constructor(
host: string,
port: number,
options?: {
/** default 2000 */
reconnect_interval?: number
/** default true */
reconnect?: boolean
}
)
/** Force a reconnection attempt */
connect(): void
/** Write a message to the socket */
write(message: string | Buffer, cb: (err: Error | undefined) => void): void
/** Write a message to the socket */
write(message: string | Buffer, cb: (err: Error | undefined) => void): void
/** Shutdown and cleanup the socket */
destroy(): void
}
export = Telnet