Class: Strategy

Strategy

new Strategy()

Implementation of Strategy for the Node platform.
Source:

Methods

close(inPort, inCallback)

Close the UDP socket and bind to the specified port.
Parameters:
Name Type Description
inPort integer port to which to bind, eg 5353 for MDNS
inCallback function function to call on completion
Source:

getHostName() → {string}

Return the host name of the machine.
Source:
Returns:
host name
Type
string

getIPAddress() → {string}

Return the IP address of the machine.
Source:
Returns:
IP address
Type
string

listen(inCallback)

Listen for packets on the UDP socket.
Parameters:
Name Type Description
inCallback function function to call on reception
Source:

open(inCallback)

Open the MDNS socket and join the multicast group. Note only one UDP socket per strategy instance.
Parameters:
Name Type Description
inCallback function function to call on completion
Source:

send(inPacket, inRemoteAddress, inRemotePort)

Send a packet on the UDP socket.
Parameters:
Name Type Description
inPacket ArrayBuffer packet
inRemoteAddress string remote address
inRemotePort port remote port
Source:

subscribe(inMulticastAddress, inCallback)

Subscribe the UDP socket to a multicast address.
Parameters:
Name Type Description
inMulticastAddress string multicast address to join, eg 224.0.0.251 for MDNS
inCallback function function to call on completion
Source: