Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Socket

Hierarchy

  • Socket

Index

Properties

bufferSize

bufferSize: Number

Number of buffered characters to be written

Methods

addListener

  • addListener(event: String, listener: Function): void
  • installs a new listener function to be called when the specified event is triggered by the object on which it is applied

    Parameters

    • event: String
    • listener: Function

    Returns void

address

  • address(): Object
  • returns an object containing two attributes, address and port, representing the address where the client socket is connected

    Returns Object

connect

  • connect(port: Number, host?: String, callback?: Function): void
  • opens the connection for the existing socket to which it is applied

    Parameters

    • port: Number
    • Optional host: String
    • Optional callback: Function

    Returns void

destroy

  • destroy(): void
  • closes the socket to which it is applied

    Returns void

emit

  • emit(event: String, ...args: any[]): void
  • triggers the event for the object, optionally passing arguments to the listener(s)

    Parameters

    • event: String
    • Rest ...args: any[]

    Returns void

end

  • end(): void
  • closes the socket to which it is applied

    Returns void

listeners

  • listeners(event: String): Array<Function>
  • returns an array of listeners defined for the specified event in the object

    Parameters

    • event: String

    Returns Array<Function>

on

  • on(event: String, listener: Function): void
  • installs a new listener function to be called when the specified event is triggered by the object on which it is applied

    Parameters

    • event: String
    • listener: Function

    Returns void

once

  • once(event: String, listener: Function): void
  • sets a new listener function to be called only once when the specified event is triggered for the first time by the object on which it is applied

    Parameters

    • event: String
    • listener: Function

    Returns void

pause

  • pause(): void
  • pauses the 'data' event triggered for the given socket

    Returns void

removeAllListeners

  • removeAllListeners(event?: String): void
  • removes all the listeners of the specified event for the object to which it is applied

    Parameters

    • Optional event: String

    Returns void

removeListener

  • removeListener(event: String, listener: Function): void
  • removes the specified listener from the listener array of the event for the object to which it is applied

    Parameters

    • event: String
    • listener: Function

    Returns void

resume

  • resume(): void

setEncoding

  • setEncoding(encoding: String): void
  • sets the encoding for data received from the socket to which it is applied

    Parameters

    • encoding: String

    Returns void

setMaxListeners

  • setMaxListeners(maxValue: Number): void
  • defines the maximum number of listeners that can be added per event for the object to which it is applied

    Parameters

    • maxValue: Number

    Returns void

setNoDelay

  • setNoDelay(noDelay: Boolean): void
  • disables Nagle's algorithm for the socket to which it is applied

    Parameters

    • noDelay: Boolean

    Returns void

write

  • write(data: WAKBufferInstance, encoding?: String): Boolean
  • write(data: String, encoding?: String): Boolean
  • writes data to the socket to which it is applied

    Parameters

    Returns Boolean

  • writes data to the socket to which it is applied

    Parameters

    • data: String
    • Optional encoding: String

    Returns Boolean