Show:

A messaging mechanism to carry underlying firmata messages. This is an abstract class meant to be extended.

Constructor

webduino.Transport
(
  • options
)

Parameters:

  • options Object

    Options to build the transport instance.

Methods

addListener
(
  • type
  • listener
)

Add a listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

close ()

Close and terminate the transport.

emit
(
  • type
  • object,...
)

Emit an event of certain type.

Parameters:

  • type String

    Event type.

  • [object,...] Object optional

    Event object(s).

flush ()

Flush any buffered data of the transport.

listeners
(
  • type
)

Return the listener list bound to certain type of event.

Parameters:

  • type String

    Evnet type.

on
(
  • type
  • listener
)

Alias for EventEmitter.addListener(type, listener)

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

once
(
  • type
  • listener
)

Add a one-time listener for a certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

removeAllListeners
(
  • type
)

Remove all listeners of certain type.

Parameters:

  • type String

    Event type.

removeListener
(
  • type
  • listener
)

Remove a listener for certain type of event.

Parameters:

  • type String

    Event type.

  • listener Function

    Event listener.

send
(
  • payload
)

Send payload through the transport.

Parameters:

  • payload Array

    The actual data to be sent.

setMaxListeners
(
  • n
)

Set maximum number of listeners that is allow to bind on an emitter.

Parameters:

  • n Number

    Number of listeners.

Attributes

isOpen

Boolean readonly

Indicates if the state of the transport is open.

Events

TransportEvent.CLOSE

Fires when a transport is closed.

TransportEvent.ERROR

Fires when a transport get an error.

TransportEvent.MESSAGE

Fires when a transport receives a message.

TransportEvent.OPEN

Fires when a transport is opened.