Class: Stream

Stream


new Stream()

The class representing Carrier stream.

Source:

Members


carrier

Properties:
Name Type Description
carrier Carrier

Parent carrier object.

Source:

id

Properties:
Name Type Description
id number

Stream ID.

Source:

session

Properties:
Name Type Description
session Session

Parent session object.

Source:

Methods


closeChannel(onSuccess [, onError], channel)

Close a new channel on multiplexing stream.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

channel number

The channel ID to close

Source:

closePortForwarding(onSuccess [, onError], portForwarding)

Close a port forwarding.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

portForwarding number

The portforwarding ID.

Source:

getTransportInfo(onSuccess [, onError])

Get tranport info of carrier stream.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a TransportInfo object

onError function <optional>

The function to call when error, the param is a String. Or set to null.

Source:

on(name, callback)

Add or remove Stream callback.

Parameters:
Name Type Description
name string

The callback name.

callback function

The function to add or change callback function. If set to null, will remove callback.

Source:

openChannel(onSuccess [, onError], cookie)

Open a new channel on multiplexing stream.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a Number: New channel ID.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

cookie string

The application defined data passed to remote peer

Source:

openPortForwarding(onSuccess [, onError], service, protocol, host, port)

Open a port forwarding to remote service over multiplexing.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a Number: Port forwarding ID.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

service string

The remote service name

protocol PortForwardingProtocol

Port forwarding protocol

host string

Local host or ip to binding. If host is null, port forwarding will bind to localhost

port number

Local port to binding.

Source:

pendChannel(onSuccess [, onError], channel)

Request remote peer to pend channel data sending.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

channel number

The current channel ID.

Source:

resumeChannel(onSuccess [, onError], channel)

Request remote peer to resume channel data sending.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

channel number

The current channel ID.

Source:

write(onSuccess [, onError], data)

Send outgoing data to remote peer.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a Number: Bytes of data sent.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

data base64

The send data.

Source:

writeChannel(onSuccess [, onError], channel, data)

Send outgoing data to remote peer.
If the stream is in multiplexing mode, application can not call this function.

Parameters:
Name Type Argument Description
onSuccess function

The function to call when success, the param is a Number: Bytes of data sent.

onError function <optional>

The function to call when error, the param is a String. Or set to null.

channel number

The current channel ID.

data base64

The send data.

Source: