Skip to main content
Chicohuman
Known Participant
July 23, 2011
Question

Question about when subscribing to a directly published stream

  • July 23, 2011
  • 1 reply
  • 7999 views

Hi,

In the article there : http://www.adobe.com/devnet/flashmediaserver/articles/real-time-collaboration.html#articlecontentAdobe_numberedheader_1

We can see this under 'User lookup'

RTMFP assigns a peer ID to each participant. These peer IDs are 256 bits long and are non-forgeable. When you want to subscribe to a directly published stream, you must specify the publisher's peer ID:

var receiveStream:NetStream = new NetStream(netConnection, id_of_publishing_client);
receiveStream.play("media");
In another thread, Michael said :
i believe the problem is that you are attempting to make a P2P connection to the server's peer ID; that is, something like
"

   var ns:NetStream = new NetStream(netConnection, netConnection.farID);

   ns.play(...);

under the covers, this will open a new RTMFP flow to the server that will appear to the server as a new incoming client, but the initial handshake will be incorrect (the first/only command message is "play" instead of "connect").  i see this on Cirrus all the time.

Is it an error in the article or is it right considering the scenario?

Thanks

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    July 26, 2011

    you specify the peer ID of the publisher for 1:1 P2P communication.  in particular, you specify the peer ID of a peer that is publishing a stream on a P2P publishing NetStream -- one created with ns = new NetStream(netConnection, NetStream.DIRECT_CONNECTIONS).

    Flash Media Server does not publish streams in this fashion.  it publishes streams in the traditional client-server fashion.  to subscribe to a stream from the server, you just use ns = new NetStream(netConnection) and do not specify a peer ID or other special token (well, there is a special token, but it's the default -- the previous call is equivalent to ns = new NetStream(netConnection, NetStream.CONNECT_TO_FMS)).

    as i explained earlier, if you try to subscribe to an FMS stream using the DIRECT_CONNECTIONS P2P method, it will not work because the handshake is different.  the server end of your NetConnection is not a peer and it will not behave like a peer.  a server-side NetConnection is a peer and will have its own distinct peer ID; however, i don't believe any of the 1:1 P2P functions will work with it, only group stuff (multicast NetStreams and NetGroups).