Setting RTMP ports for your FDS Flex apps
October 25th, 2006
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”.