ServerRegistry:
Filter:
Utopia/Classes (extension) | Relay classes

ServerRegistry
ExtensionExtension

Provide a shared dictionary of servers across a Utopia

Description

ServerRegistry is a Dictionary-like class that provides a way to register Servers automatically between a number of Peers. For the simple case of one server per Peer, the -addMyServer method is useful, but more complicated arrangements, with multiple servers, shared servers, and servers on non-Peer machines are also possible.

Class Methods

.new

Create a new ServerRegistry.

Arguments:

addrBook

An AddrBook where Peers are registered. Note that these are the addresses of Peers who will share servers by adding them to the registry, not the addresses of the servers themselves.

options

A ServerOptions to use for creating new Servers. In the current implementation, ServerOptions are not shared.

oscPath

An optional OSC compliant path in the form of a Symbol or String used to identify this ServerRegistry. If nil the default '/serverRegistry' will be used.

Returns:

A new ServerRegistry.

Instance Methods

.keys

Get the names of the Servers in this registry.

Returns:

A Set containing the names of the Servers as Symbols.

.values

Get the Server objects in this registry,

Returns:

A Set containing the Servers.

.at

Get a Server from the registry.

Arguments:

key

A Symbol corresponding to the name of the Server.

Returns:

A Server, or nil if there is no Server with the requested name.

.addMyServer

Convenience method to add my local server

Arguments:

server

An optional Server to add. In most cases this can be left blank, which will add the default Server.

.put

Add a Server to this registry.

Arguments:

name

A Symbol corresponding to the name of the Server.

server

The Server to put at this key.

Examples