Class: MicroForwarderTransport

MicroForwarderTransport

new MicroForwarderTransport(onReceivedObject)

A MicroForwarderTransport extends Transport to connect to the browser's micro forwarder service. This assumes that the MicroForwarder extensions has been installed.
Parameters:
Name Type Description
onReceivedObject function (optional) If supplied and the received object type field is not "Buffer" then just call this.onReceivedObject(obj).
Source:

Methods

(static) ConnectionInfo()

Create a new MicroForwarderTransport.ConnectionInfo which extends Transport.ConnectionInfo to hold info for the micro forwarer connection.
Source:

connect(connectionInfo, elementListener, onopenCallback, onclosedCallback)

Connect to the micro forwarder according to the info in connectionInfo. Listen on the connection to read an entire packet element and call elementListener.onReceivedElement(element). However, if the received object type field is not "Buffer" then just call this.onReceivedObject(obj).
Parameters:
Name Type Description
connectionInfo MicroForwarderTransport.ConnectionInfo
elementListener object The elementListener with function onReceivedElement which must remain valid during the life of this object.
onopenCallback function Once connected, call onopenCallback().
onclosedCallback type If the connection is closed by the remote host, call onclosedCallback().
Source:

isLocal(connectionInfo, onResult, onError)

Determine whether this transport connecting according to connectionInfo is to a node on the current machine. Unix transports are always local.
Parameters:
Name Type Description
connectionInfo MicroForwarderTransport.ConnectionInfo This is ignored.
onResult function This calls onResult(true) because micro forwarder transports are always local.
onError function This is ignored.
Source:

send(buffer)

Send the buffer over the connection created by connect.
Parameters:
Name Type Description
buffer Buffer The bytes to send.
Source:

sendObject(obj)

Send the JavaScript over the connection created by connect.
Parameters:
Name Type Description
obj object The object to send. It should have a field "type". If "type" is "Buffer" then it is processed like an NDN packet.
Source: