If you’re going to be running more than one Flex Data Services enabled webApp on your server it’s important that you give each one its own unique RTMP port number. As far as I can see this isn’t explained in the FDS docs, so it’s worth a post.

I was initially made aware of this when a kind soul left a comment on my most recent post. I then posted a question to the flexcoders list and got a lot of useful info. You can read the entire thread here but I’ll try to summarize the important practical points in this post.

The simplest way to create a new FDS webApp is to copy the “flex” template webApp that is supplied when you install FDS. Once you do this open its \WEB-INF\flex\services-config.xml file and search for “rtmp://{server.name}:”

You’ll see that the RTMP port is set to 2038. You need to change this. I’ve been advised to just use 2039, then 2040 for my next webApp, etc. Be aware that the “samples” webApp that comes with FDS uses 2037.

That’s all you really need to know. The rest of this post contains some interesting (to me) details.

First of all, I wondered whether I also needed to set unique ports for HTTP and AMF channels. The answer was “that depends”. Here’s what Pete Farland wrote:

“If you’re going to host the SWF files in the same enterprise Java application server that deploys the web application containing the FDS message broker servlet then you can rely on the {server.port} token in the channel endpoint configuration to mean “replace this at runtime with the port used to load the SWF”. However more complex deployments are possible and you may have several web servers running on different ports, or even different hosts for channel failover in which case you would need to be aware of the ports no matter what protocol was being used for communication.

“Alternatively, if you know the exact host name and port (and context-root for that matter) of the FDS web application then you can remove the tokens from the channel endpoint altogether and just hard code the values if it makes it simpler to follow.”

Second, I was concerned that these ports aren’t registered with the IANA. The IANA maintains a list of registered ports so that venders can ship applications with some confidence that they won’t use the same ports as other vendor’s apps. Is there any danger of that? Here’s Seth Hodgson’s response:

“… just pick your own range. … Trampling on the registered port for Mike O’Brien’s chat app (2031) for example isn’t going to be an issue unless you happen to be running that app on your server as well, and if you happen to collide with something FDS will throw an exception on startup and you can pick a different port.”

In other words, “don’t worry about it” and “if your webApp doesn’t work, take a look at the log files and you’ll be able to resolve the problem fairly easily”.

9 Responses to “Setting RTMP ports for your FDS Flex apps”

  1. Scott Brison Says:

    Great Site! I was looking for this since, since, I don’t know when….
    At last, everything worked

  2. Clint Modien Says:

    Nice post…

    Trackback URL:

  3. Kibong Says:

    Thanks so much!

    I’ve spent 2 foooool days digging into this problem.

    It was only you that addressed my problem clearly.

    Thanks again.


  4. Targo Pavlista Says:

    Thanks so much – I was really confused…

  5. shridhar Says:

    After changing the rtmp port i am getting undefined url:rtmp:/localhost:2039 error what might be the cause for this

  6. Paul Says:

    Very helpful thank you. It appears there is a lot the FDS docs have missed out. I would be nice if Adobe focused on the products documentation and quality rather than the products hype.

  7. GJM Says:

    Very helpful. Thanks.

  8. todd Says:

    Thank You…..many hours lost trying to track dowm this problem, you saved me many more. Great JOB!!!

  9. Peter Says:

    You said :
    The simplest way to create a new FDS webApp is to copy the “flex” template webApp that is supplied when you install FDS

    Is there a way to have FDS published once or to move the jars somewhere ? flex.war is over 10MB size.

    I tried to put flex/WEB-INF/lib into my server/default/lib direcory (on JBoss 4.2.0 GA) but then I get error, that class specified in cannot be created. Maybe I should put classpath somewhere?
    Once I move back all the jars to application lib everything works fine

Leave a Reply

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image