Conncet to server
port number
host ip address
listener callback
emit message example) emit(event: 'close', hadError: boolean): boolean; emit(event: 'connect'): boolean; emit(event: 'data', data: Uint8Array): boolean; emit(event: 'drain'): boolean; emit(event: 'end'): boolean; emit(event: 'error', err: Error): boolean; emit(event: 'lookup', err: Error, address: string, family: string | number, host: string): boolean; emit(event: 'ready'): boolean; emit(event: 'timeout'): boolean;
event name
close socket
set linstener example) on(event: string, listener: (...args: any[]) => void): this; on(event: 'close', listener: (hadError: boolean) => void): this; on(event: 'connect', listener: () => void): this; on(event: 'data', listener: (data: Uint8Array) => void): this; on(event: 'drain', listener: () => void): this; on(event: 'end', listener: () => void): this; on(event: 'error', listener: (err: Error) => void): this; on(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; on(event: 'ready', listener: () => void): this; on(event: 'timeout', listener: () => void): this;
event name
listening callback
set linstener example) once(event: string, listener: (...args: any[]) => void): this; once(event: 'close', listener: (hadError: boolean) => void): this; once(event: 'connect', listener: () => void): this; once(event: 'data', listener: (data: Uint8Array) => void): this; once(event: 'drain', listener: () => void): this; once(event: 'end', listener: () => void): this; once(event: 'error', listener: (err: Error) => void): this; once(event: 'lookup', listener: (err: Error, address: string, family: string | number, host: string) => void): this; once(event: 'ready', listener: () => void): this; once(event: 'timeout', listener: () => void): this;
event name
listening callback
send data to server
the data will be sent
Generated using TypeDoc
TCP Client
2