| Programming Flash Communication Server |
Top Ten Questions about Programming Flash Communication Server
I've been keeping a check list of common problems and questions people run
into when developing applications using the Flash Communication Server. I plan
to use the list to make sure we do a decent job of answering questions and
explaining things in the book. Recently I asked if people would post their
top ten difficult questions about FCS on the Figleaf flashcomm
mailing list.
This is my compilation/summary of the results. A link to the original posts
is at the bottom of the page. If you have other suggestions please post them
on the Flashcomm list.
- Multi user programming is confusing. How do I write code that allows one
person to do something and everyone else to see what that person did in the
same Flash movie? How do I know if the code is in the sender or receiver's
Flash movie? How can the same code work for different people?
- Remote Shared Objects are not something people are used to working with.
A good diagram showing their structure and the list of information objects
received by onSync() would help. Also a good interaction diagram showing local
and server-side updates in sequence.
- Why use methods attached to a prototype vs methods attached to an instance.
(Especially with the Client object.)
- What are the best practices for structuring and maintaining server-side
ActionScript?
- How do you control streams from the server? For example having every client
"tune in" to a stream but have the server dynamically change the
content of that stream?
- How do you code callbacks and other asynchronous events while keeping your
code simple and readable?
- What are the best practices for organizing and coding in Flash when developing
a communication app?
- Where should I work with bytes or bits in Flashcom apps and how do I translate
between them? Also, why are both used?
- How do you setup proxies (streams, shared objects, and methods) and why?
How do you simplify the coding of these?
- How do you write a secure application? For example stop someone in mid-stream
if you need to prevent them filling up your file system or stop them from
using your app with their own swf or using your swf/app for their own purposes.
- How do I control client bandwidth usage as well as the total instance, application,
and server usage? What application level and client level bandwidth settings
should I use? How can I support clients with different network bandwidths
such as modem and DSL users in the same app? How do I tune the bandwidth to
just what each client needs - for example to play a prerecorded stream but
no more? (Or disable write access entirely).
- When I have to make a remote function call I need to setup a responder object
(or resultObject). For example nc.call("methodName", responderObject,
parameter1, ...) how do I setup the responder? Should I use the same object
as a responder for each call or create a separate responder object each time?
Should I setup a relay object and relay the results to different objects?
Is this different from how I work with Remoting?
- SharedObjects can't be subclassed so how do I make onSync() handlers do
what I want? Do I customize each shared object with its own custom onSync()
method? Should I wrap shared objects in another object or have shared objects
broadcast events to other objects that act on them? Even though I can subclass
a NetStream I'd rather not except maybe to get a more functional type of stream.
So, when methods are called on streams and shared objects what is the best
way to deliver or delegate those calls to another object? How do I set that
up?
- How does resource naming work? I can have an app instance at rtmp://my.host.com/appOne/appInstanceThree
and another at rtmp://my.host.com/appOne/appInstanceFive and each can have
a shared object named "public/messages". Are they the same shared
object? How do resources in one instance relate to resources in another? Does
that have anything to do with the component naming scheme of ComponentClass.ComponentInstance
and the resources they manage?
- How can I record everything that happens in an instance session and play
it back later? For example I have an online auction and want to play back
the entire event including the bids that were made and the voice of the auctioneer.
- What can I do about user's who don't know how to adjust the volume/gain
of their microphone or the settings on their camera? Can I make it possible
for a presenter or manager of an instance to take control of the user's sound
and video settings?
- How do I get my shared object data into a List or DataGrid? What is the
fastest and safest way and why can't I just do this: dataGrid.dataProvider
= so.data; or this: myDataProvider[0] = so.data[slotName];? What are the safe
ways to update a dataprovider with shared object data? Are there times when
I shouldn't even do this: list.addItem(slotName, so.data[slotName]); ?
- Why can't I user so.data.property = value; in server-side ActionScript?
Why do I have to so.setProperty(propertyName, propertyValue); instead?
- Sometimes I can use a Stream, NetStream, SharedObject, or a remote method
call as soon as I create a NetConnection object. Other times I have to wait
for the connection to complete. Why is that and when do I have to wait? Same
question with proxied shared objects, streams, and remote methods.
- What's the difference between rtmp:/appName/appInstance and rtmp://host.name.com/appName/appInstance.
When can I use the shorter form?
- How do I create server-side playlists?
- How do I setup VHosts and what difference does having multiple virtual hosts
have, if any, on developing applications? Are there special things I should
look for when developing in a hosted environment?
- Where do I put my files? Does my swf have to be in a subdirectory of the
applications directory? Does the applications directory have to be under my
Web root? Is the browser connecting to Flashcom on behalf of my swf or is
my swf connecting directly?
Original Posts
You can see all the original posts by going to http://chattyfig.figleaf.com/search and
entering the text: Top ten difficult Flashcom questions.
Document first posted April 20, 2004 by Brian Lesser