Skip to main content
April 1, 2010
Question

FMS 3.5 / server/app1 -> netconnect -> server/app2 = NetConnect.Connect.FailedHello

  • April 1, 2010
  • 1 reply
  • 1393 views

Hello all,

I've hit a snag with my current FMS project and Im hoping someone out there might be able to help.

I have a working FMS server with two applications:

I'm trying to get application 2 to connect to application1.

I can connect to app1 if i write up a quick client in as3... i CANT seem to connect from FMS server side code in app2. ( which is what I require )

What am I doing wrong?  Is there something on the server that I need to configure to allow this?

Do I need to specify something in one of the app's  Application.xml files?

Thank you for taking the time to read this post,  code is below:

other info:

     my development server url looks like this:    fms.internal.companyname.com
     my netConnection.uri is simply "rtmp://fms.internal.companyname.com/app1"

     running Flash Media Interactive Server 3.5

     server is working.  I can use live / vod / and some other custom apps that I've written so far.  Just app to app connections aren't functioning.

    I havn't done any other custom configuration to the server.  Its all stock.

app1's code:

application.allowDebug = true;

application.onAppStart = function(){

     trace("[ Booting up app1 ]");

}

application.onConnect = function( clientObj ){

    trace("onConnect detected: ");

     application.acceptConnection(clientObj);

};

application.onStatus = function(statusObj){

     trace("onStatus detected:  "+ statusObj);

}

app2's code:

application.allowDebug = true;

nc = new NetConnection();

nc.onStatus = function(infoObj){

   trace(infoObj.code);

}

application.onAppStart = function(){

     trace("[ Booting up app2 ]");

     nc.connect( "rtmp://server/app1");

}

application.onStatus = function(statusObj){

     trace("[ onStatus: "+statusObj+" ]");

}

So as you can see I'm having app2 connect up to app1 on startup.
However, no matter what I do I can't seem to get them to connect!  Please help!
App 2's log tells me that "NetConnection.Connect.Failed".
When I check the over all server log I just get a "Connection failed"

    This topic has been closed for replies.

    1 reply

    calmchessplayer
    Inspiring
    April 1, 2010

    I don't think you can do that the easiest way for you to accomplish what you want is to  pass a parameter to onConnect from the client side NC connection  string wich tells the server side script which swf is connecting up and then use if statments with that parameter to carry out code for each client......i do this all the time and call the parameter "type"......if this totally doesn't appeal to your logic then tell me exactly what you are trying to accoplish.

    April 1, 2010

    Thanks Chess,

    Ok.. sounds like I'm going about this all wrong... 

    I'm building out an Audio/Video Chat application.. ( who doesn't with FMS?    )

    My specific challenge with this project is that I need to pass the client app "secret" data that I can't allow other users to have access to.

    ( By secret I mean I need to push the username and password for another app down to the client. so I'll be using RTMPE or RTMPS by the time this goes live. )

    So how does the following sound?

    My client, ( a flex RIA )  will provide my server "myserver.com/ChatServer"  with a "token":String that can uniquely identify that user.

    So say clientA wants to connect to chat session "42"..   it connects up to "myserver.com/ChatServer/42"  and provides their token.

    1.     When ChatServer/42   onConnect Method fires it will take that token and will put the client into a pending state.

    2.     The server will then hit a webservice on another server with that user's token and the name of the instance.   ( "user_token", "42") and will get back a UserData object... or xml... or whatever FMS uses best for transmitting data i guess... ( would FMS work with ZendAMF?  I'd love to use typed objects for this!)

    3.     Once the ChatServer instance receives the UserData it will pass it back to the client via Client.Call("setClientCredentials", responder, clientData stuff);   // I need to get secret data back to the client that I don't want made available to other users.  ( their passwords etc... )

    4.     ChatServer will also accept the client connection at this point and Add this client to a Roster Shared Object along with some specifics from that ClientData... like name, avatar, etc.

    5.  Once the approved clients begin broadcasting I can then update that Roster_shared_object and use the .sync events to have all connected clients update and start sucking down those streams.

    Does this sound like a better FMS architecture?

    I appreciate everyone's input,

    Thank you for taking the time to read up to this point. 

    calmchessplayer
    Inspiring
    April 1, 2010

    well i think you are spot on in your thinking you just gonna have to figure out how to code it

    us amfphp to handle data from the database I use php sessions to handle alot of my client data i think both those methods could be used securely as the client wouldn't ever see the php file that is being called by URLLOADER/loadvars and amfphp is designed to be more secure. you should practice sending data to the server onConnect call  via NetConnecton connect parameters