Class: PeerJsConnector

Defined in: lib/Connectors/PeerJsConnector.coffee

Overview

PeerJs is a Framework that enables you to connect to other peers. You just need the user-id of the peer (browser/client). And then you can connect to it.

See also:

Instance Method Summary

Constructor Details

# (void) constructor(engine, HB, execution_listener, yatta)

Parameters:

  • engine ( Engine ) The transformation engine
  • HB ( HistoryBuffer )
  • execution_listener ( Array<Function> ) You must ensure that whenever an operation is executed, every function in this Array is called.
  • yatta ( Yatta ) The Yatta framework.

Instance Method Details

# (void) connectToPeer(id)

Connect the Framework to another peer. Therefore you have to receive his user_id. If the other peer is connected to other peers, the PeerJsConnector will automatically connect to them too.

Transmitting the user_id is your job. See TextEditing for a nice example on how to do that with urls.

Parameters:

  • id ( String ) Connection id

# (Array<String>) getAllConnectionIds()

Receive the id of every connected peer.

Returns:

  • ( Array<String> ) — A list of Peer-Ids

# (void) onNewConnection(f)

# (void) addConnection(conn)

Adds an existing connection to this connector.

Parameters:

  • conn ( PeerJsConnection )

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: