
71
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
GroupSpecifier class
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.
Komentarze do niniejszej Instrukcji