The GroupSpecifier class is used to construct the opaque strings called “groupspecs” to pass to NetStream and NetGroup constructors. A groupspec specifies an RTMFP peer-to-peer group, including the capabilities, restrictions, and authorizations of the member using the groupspec.By default, all capabilities are disabled, and peer-to-peer connections are allowed.

Neighbors within an RTMFP group may be introduced to each other in the following ways:

  • Server channel automatic bootstrapping.

    When clients connect over an RTMFP connection, the server bootstraps them with peers who are members of the same group. To enable automatic bootstrapping, set GroupSpecifier.serverChannelEnabled to true.

  • Explicit peerID exchange.

    Two or more peers pass their peerIDs to each other. There are any number of ways for peers to exchange peerIDs, from web services to telling each other verbally.

  • LAN peer discovery

    Use the GroupSpecifier class for LAN peer discovery. LAN peer discovery allows a server-side RTMFP NetConnection and its NetStream and NetGroup objects to automatically locate peers and join a group on the current subnet. Peers cannot discover each other unless they’re in the same group on the same subnet of the LAN. If peers with matching groupspecs are on different subnets, no error or other event is dispatched if they fail to discover each other.

    The following code shows how to enable LAN peer discovery in Server-Side ActionScript. The code would be written within an event callback function or in an RPC function.

    var nc = new NetConnection(); // Protocol must be RTMFP nc.connect("rtmfp://localhost/appname"); var gs = new GroupSpecifier("discovery-test"); // Must be enabled for LAN peer discovery to work gs.ipMulticastMemberUpdatesEnabled = true; // Multicast address over which to exchange peer discovery. gs.addIPMulticastAddress("224.0.0.255:30000"); // Necessary to multicast over a NetStream. gs.multicastEnabled = true; var ns = new NetStream(nc, gs.toString());

GroupSpecifier constructor

 new GroupSpecifier(name:String)

Creates a GroupSpecifier object. By default, all capabilities are disabled, and peer-to-peer connections are allowed.

Availability

Flash Media Server 4

Parameters

name

A String specifying a name for the group. All members must use this name to join the group.

Returns

A GroupSpecifier object if successful. If the name parameter is missing or null, throws a JavaScript error.

Example

The following example creates a GroupSpecifier object called groupSpecifier. The group created with this object will have multicast and posting enabled. The group will also have the server channel enabled.

var groupSpecifier = new GroupSpecifier("com.example.someapp"); 
groupSpecifier.multicastEnabled = true; 
groupSpecifier.postingEnabled = true; 
groupSpecifier.serverChannelEnabled = true;

GroupSpecifier.addBootstrapPeer()

 groupSpecifier.addBootstrapPeer(peerID)

Causes the associated NetStream or NetGroup to make an initial neighbor connection to the specified peerID.

Availability

Flash Media Server 4

Parameters

peerID

A String. The peerID to which an initial neighbor connection should be made to bootstrap into the peer-to-peer mesh.

Returns

Nothing.

GroupSpecifier.addIPMulticastAddress()

 groupSpecifier.addIPMulticastAddress(address, port)

Causes the associated NetStream or NetGroup to join the specified IP multicast group and listen to the specified UDP port.

If the address or port has an invalid format, a runtime error is raised.

Availability

Flash Media Server 4

Parameters

address

A String specifying the address of the IPv4 or IPv6 multicast group to join, optionally followed by a colon (":") and the UDP port number. If specifying an IPv6 address and a port, the IPv6 address must be enclosed in square brackets, for example, "224.0.0.254", "224.0.0.254:30000", "ff03::ffff", "[ff03::ffff]:30000".

port

A Number. The UDP port on which to receive IP multicast datagrams. If port is null, the UDP port must be specified in address. If not null, the UDP port must not be specified in address.

Returns

Nothing.

GroupSpecifier.authorizations()

 groupSpecifier.authorizations()

Returns a string that represents passwords for IP multicast publishing and for posting. Append the string to an unauthorized groupspec to enable features for which passwords have been set.

Availability

Flash Media Server 4

Parameters

None.

Returns

A String.

GroupSpecifier.encodeBootstrapPeerIDSpec()

 groupSpecifier.encodeBootstrapPeerIDSpec(peerID)

Encodes and returns a string that represents a bootstrap peerID. If you append the string to a groupspec, the associated NetStream or NetGroup makes an initial neighbor connection to the specified peerID.

Availability

Flash Media Server 4

Parameters

peerID

A String. The peerID to which an initial neighbor connection should be made to bootstrap into the peer-to-peer mesh.

Returns

A String.

GroupSpecifier.encodeGroupspecDigest()

 GroupSpecifier.encodeGroupspecDigest(groupspec:String)

A static method that encodes and returns the digest for the canonical portion of the supplied groupspec. Call this method to generate a groupspec digest to correlate Group join and leave events to a known Group.

Availability

Flash Media Server 4.5

Parameters

groupspec

A String. The groupspec to encode a digest for.

Returns

The digest for the canonical portion of the supplied groupspec.

GroupSpecifier.encodeIPMulticastAddressSpec()

 groupSpecifier.encodeIPMulticastAddressSpec(address, port)

Encodes and returns a string that represents an IP multicast socket address. If you append the string to a groupspec, the associated NetStream or NetGroup joins the specified IP multicast group and listens to the specified UDP port.

Throws a JavaScript error if the address or port parameters are invalid or missing.

Availability

Flash Media Server 4

Parameters

address

A String. A String specifying the address of the IPv4 or IPv6 multicast group to join, optionally followed by a colon (":") and the UDP port number. If specifying an IPv6 address and a port, the IPv6 address must be enclosed in square brackets, for example, "224.0.0.254", "224.0.0.254:30000", "ff03::ffff", "[ff03::ffff]:30000".

port

A Number. The UDP port on which to receive IP multicast datagrams. If port is null, the UDP port must be specified in address. If not null, the UDP port must not be specified in address.

Returns

A String.

GroupSpecifier.encodePostingAuthorization()

 groupSpecifier.encodePostingAuthorization(password)

Encodes and returns a string that represents a posting password. When posting is password-protected, you can concatenate the string to a groupspec to enable posting.

Availability

Flash Media Server 4

Parameters

password

A String. The password to encode, which must match the posting password (if set) to enable NetGroup.post().

Returns

A String.

GroupSpecifier.encodePublishAuthorization()

 groupSpecifier.encodePublishAuthorization(password)

Encodes and returns a string that represents a multicast publishing password. When multicast publishing is password-protected, you can concatenate the string to a groupspec to enable posting.

Availability

Flash Media Server 4

Parameters

password

A String. The password to encode, which must match the publish password (if set) to enable NetStream.publish().

Returns

A String.

GroupSpecifier.groupspecWithAuthorizations()

 groupSpecifier.groupspecWithAuthorizations()

Returns the opaque groupspec string, including authorizations, that can be passed to the NetStream and NetGroup constructors.

Availability

Flash Media Server 4

Parameters

None.

Returns

A String.

GroupSpecifier.groupspecWithoutAuthorizations()

 groupSpecifier.groupspecWithoutAuthorizations()

Returns the opaque groupspec string, without authorizations, that can be passed to the NetStream and NetGroup constructors.

Availability

Flash Media Server 4

Parameters

None.

Returns

A String.

GroupSpecifier.ipMulticastMemberUpdatesEnabled

groupSpecifier.ipMulticastMemberUpdatesEnabled

A Boolean value indicating whether or not information about group membership is exchanged on IP multicast sockets. IP multicast servers can send group membership updates to help bootstrap P2P meshes or heal partitions. Peers can send membership updates on the LAN to help bootstrap LAN P2P meshes and to inform on-LAN neighbors in global meshes that other on-LAN neighbors exist, which can improve P2P performance.

Availability

Flash Media Server 4

GroupSpecifier.makeUnique()

 groupSpecifier.makeUnique()

Adds a strong pseudorandom tag to the groupspec to make it unique. The opaque groupspec string must then be passed to other potential members of the group. To join a group, a client must use this groupspec string.

Availability

Flash Media Server 4

Parameters

None.

Returns

Nothing.

GroupSpecifier.multicastEnabled

groupSpecifier.multicastEnabled

A Boolean value specifying whether or not streaming over a NetStream is enabled for the specified group. The default value is false.

Availability

Flash Media Server 4

GroupSpecifier.objectReplicationEnabled

groupSpecifier.objectReplicationEnabled

A Boolean value specifying whether or not Object Replication is enabled for the specified NetGroup. The default value is false.

Availability

Flash Media Server 4

GroupSpecifier.peerToPeerDisabled

groupSpecifier.peerToPeerDisabled

A Boolean value specifying whether or not peer-to-peer connections are disabled in this NetGroup or NetStream. The default value is false.

If peer-to-peer connections are disabled, it is guaranteed that no upstream bandwidth will be used by any member of the group because no neighbor connections will be made. If peer-to-peer connections are disabled, the peer-to-peer warning dialog is suppressed. This mode is only useful for sending and receiving multicast streams using pure IP multicast.

Availability

Flash Media Server 4

GroupSpecifier.postingEnabled

groupSpecifier.postingEnabled

A Boolean value specifying whether or not posting is enabled for the specified NetGroup. The default value is false. For information about posting, see NetGroup.post().

Availability

Flash Media Server 4

GroupSpecifier.routingEnabled

groupSpecifier.routingEnabled

A Boolean value specifying whether or not the directed routing methods are enabled in the specified NetGroup. The default value is false.

Availability

Flash Media Server 4

GroupSpecifier.serverChannelEnabled

groupSpecifier.serverChannelEnabled

A Boolean value specifying whether or not members attempt to open a channel to the server for this group. The default value is false.

A channel to the server must be open before the server can provide supporting functions, such as bootstrapping, to group members. Supporting functions may or may not be provided over this channel depending on server configuration.

To use the server channel for automatic bootstrapping, set the JoinLeaveEventsmode attribute to "All" in the Application.xml file.

<GroupControl> 
    <JoinLeaveEvents mode="All"/> 
</GroupControl>

Availability

Flash Media Server 4

GroupSpecifier.setPostingPassword()

 groupSpecifier.setPostingPassword(password, salt)

Specifies a password that is required to call NetGroup.post().

Availability

Flash Media Server 4

Parameters

password

A String. The password. If null, no password is required to post. The default value is null.

salt

A String. Modifies the hash of the password to increase the difficulty of guessing it. For best security, this parameter should be set to a random value. The default value is null.

Returns

Nothing.

GroupSpecifier.setPublishPassword()

 groupSpecifier.setPublishPassword(password, salt)

Specifies a password that is required to call NetStream.publish() to multicast publish into a group.

Availability

Flash Media Server 4

Parameters

password

A String. The password. If null, no password is required. The default value is null.

salt

A String. Modifies the hash of the password to increase the difficulty of guessing it. For best security, this parameter should be set to a random value. The default value is null.

Returns

Nothing.

GroupSpecifier.toString()

 groupSpecifier.toString()

Identical to the groupspecWithAuthorizations() method. Convenience method to return the opaque groupspec string, including authorizations, to pass to NetStream and NetGroup constructors.

Availability

Flash Media Server 4

Parameters

None.

Returns

A String.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy