Class: palava.Distributor

Defined in: coffee/distributor.coffee

Overview

Distributor supports exchanging direct messages with peers through a channel. The incoming messages are filtered and outgoing messages are are sent within appropriate send_to_peer messages.

Instance Method Summary

Constructor Details

# (void) constructor(channel, peerId = null)

Parameters:

  • channel (palava.Channel) The channel to connect through
  • peerId (String) The id of the peer to connect to or null for global messages

Instance Method Details

# (void) on(event, handler) Bound

Adds a handler to the Distributor

Examples:

distributor.on 'peer_left', (msg) => console.log "peer left!"

Parameters:

  • event (String) Event id on which the handler is called
  • handler (function) This function is called when the event is received

# (void) send(msg) Bound

Sends a message through the Distributor

Parameters:

  • msg (Object) The message to send through the distributor

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: