Just to chime in on this briefly.  You can fairly easily build a chat system using FDS without dynamically defined client and server destinations and it is not too much work though it has some limitations in how it will scale if you take the simple approach.  I think for Tom’s particular scale requirements, this approach would not be sufficient but if you are only dealing with a server that has at most a couple of thousand concurrent users, this may well be the easiest and best approach, especially if your app requires some back-end integration.   Of course the exact load you could support would vary based on your setup but you’d be able to expect a reasonably high volume of messages/second hundreds but probably not multiple thousands.  To get extra scale, you have change the messaging topology we use in today’s FDS (something that we are considering adding “out of the box” for a future release).   Here is the outline of this approach:

 

-          Basically each user could create a Consumer with a subtopic to receive chat messages and presence queries.  You could use the IM identity as part of the subtopic name – e.g. “myIdentity.messages”.  The client would also send messages to a different subtopic also based on the identity for publishing presence events e.g. myIdentity.presence.   When the client connects, it would also send an initial “I am available” message to the myIdentity.presence subtopic, then would send additional messages such as “I am idle” as its presence state changes.   On the server side, you’d have a session destroy listener which would send the final “I am disconnected” message to this subtopic from server code.   If you are using HTTP sessions, you should probably put a timestamp in each presence message and the timestamp for this “disconnected” message should be the current time minus the session expiration time interval (since that is the time of last request seen by this user when the session expires).  Make sure you do not replace a more recent presence event with an older one in case this user has logged on via a different browser in the meantime.

-          Secondly, to get visibility for other user’s presence events, the client would make an RPC call to some server component you provide which supplies the client with their buddy list.  The consumer would then issue Consumer.subscribe calls for each buddy’s identity’s presence subtopic.   Once it had subscribed to all of these, it would send a “presence query” message to the myIdentity.messages subtopic.  In response to a presence query, the client just sends a presence event to its myIdentity.presence subtopic with its current presence state.  One other type of message you receive on the myIdentity.messages subtopic would typically be actual IM’s.  The body or headers of the message can contain things like the thread-id, the sender etc.  You’d also use this channel to send other control messages such as “an add buddy request” has been received.

 

Of course a real IM system requires authentication and access control, buddy list approval but I think you can implement this with these two subtopics per user.  One representing data and control messages intended for the client, the other for data and control messages sent by the client.    For buddy list approval, you send another control message to the user’s “myIdentity.messages” subtopic and the buddy would reply with a control message to the other user’s “theirIdentity.messages” channel.   You can extend the class flex.messaging.services.messaging.adapters.MessageAdapter and override the allowSubscribe and allowSend methods to add authentication. 

 

The scalability is limited in this approach because with the current FDS “out of the box” messaging topology, every message goes through all servers in the cluster so it will not continue to scale as you add servers.  It will work in a clustered environment though and so will provide fault tolerance.

 

It is also possible for you to change the messaging topology with a custom message adapter though now you would be getting into some real coding effort.  To do this, you must handle subscriptions yourself by overriding the “handlesSubscriptions” and then the “manage” method gets called with the subscribe and unsubscribe messages.  I think a more scalable topology for chat would be to broadcast only the subscribe, unsubscribe, and presence change events, then to cache the presence state for all users on all servers.  This would add an order of magnitude or two of scalability in an IM system.  To get complete scalability, you partition the users using some kind of a hashing scheme.  

 

Jeff


From: [email protected] [mailto:[email protected]] On Behalf Of Aldo Bucchi
Sent: Tuesday, August 29, 2006 7:32 PM
To: [email protected]
Subject: Re: [flexcoders] Building a chat server over FDS... impossible is nothing??

 

Hi Tom,

> I think FDS is a great solution for a lot of different problems, but it's just not the right tool for the job in our case.

Yup, we definitely agree on that one.

OTOH, I can't build this app exclusively on FMS since the connections,
states, etc are used in the business logic ( java ), which is tightly
coupled to a CTI server.
The FMS to Java bridge never got released and, in my opinion, is still
very limited since it only provides RPC interop. There should be some
way to expose FMS's stateful "environment" to java.

My 2 cents is that this sort of enterprise presence/stateful server
has probably been scheduled for a new FDS release or some other
product in the Breeze family.

I am really really stuck here since using RPC to connect both worlds
would make the project's complexity grow exponentially.

Seems that we would have to make everything live in FMS ( all business
logic ) and use it's rpc capabilities only to talk to the external
systems ( ldap, cti, etc ), which is almost unnacceptable according to
this particular client's standards.

Comments really appreciated,
Thanks

Aldo

On 8/29/06, Tom Bray <[EMAIL PROTECTED]com> wrote:
>
>
> Hi Aldo,
>
> We have a large, high-usage chat app built with FMS and we spent quite a bit of time investigating FDS as an alternative. My conclusion is that FDS just isn't the right tool for the job. It's adequate for small, simple chat features that you may want to add to some other app (like the dashboard example that ships with FDS), but not large scale chat apps like what we have running on MySpace.
>
> Our FMS app relies on being able to dynamically create remote SharedObjects as needed and for clients to dynamically become aware of and subscribe to them (like for user-created rooms). While I was able to figure out how to dynamically create destinations in FDS without using the XML config files, it's not a documented part of the API and I had to do something pretty ugly to provide the destination config xml to the client at runtime. Normally, the destination config information is inserted into the client at compile time, which is a major limitation. You can get around this, but it's kludgy, undocumented, and it may break with subsequent releases of FDS.
>
> We also need to be able to manage connections on the server side and keep track of connected clients in a convenient way (like looping through the Application.clients array in FMS). That's really painful in FDS.
>
> And push is *much* easier in FMS.
>
> We were excited about the idea of moving our server-side logic out of the single-threaded jscript runtime of FMS, but I just kept running into roadblock after roadblock with FDS. I hope that someday FMS or a derivative of it sits on top of FDS to hide some of the complexities of FDS while allowing us to get down into the lower-level workings if we want to.
>
> I think FDS is a great solution for a lot of different problems, but it's just not the right tool for the job in our case.
>
> HTH,
>
> Tom
>
> Userplane Technologies, an AOL company
>
>
>
> On 8/29/06, Aldo Bucchi <aldo.bucchi@gmail.com> wrote:
>
> >
> >
> >
> >
> >
> >
> >
> >
> > Hi all,
> >
> > I have asked this before... it's just to see if things have changed in a while.
> > It turns out that I have a frozen Flex 2 project that requieres a Chat
> > server ( video chat actually ) and uses FDS a lot.
> >
> > I would really like to use FDS for the chat logic as well ( which is
> > actually much more complicated than a simple chat... it has queues,
> > presence states are used in business logic, etc ). But I am missing
> > the chat-oriented design of a product like FMS2.
> >
> > Note that I DO have FMS but I would end up building a really complex
> > system ( divided in two parts, which have to talk all the time... ).
> >
> > Alternatives:
> > * FDS + FMS talking through web services ( the java bridge is not
> > officially released )
> > ** horrible solution since the complexity of the system goes through the roof
> > ** Even if the java bridge existed ( I would rather have the FMS model
> > replicated in a java environment, much better ).
> > * FDS with a custom made chat server on top of messaging.
> > ** Nice, but I have to build this functionality and it is not trivial
> > ( has anyone done this already? )
> > * Red5??
> > ** I need to travel in time... and to clear the FUD for my client.
> > * Flex2.x??
> > ** time travel again...
> >
> > Any comments on this situation??
> >
> > Thanks,
> > Aldo
> >
> > --
> > ::::: Aldo Bucchi :::::
> > mobile (56) 8 429 8300
> >
> >
>
>

--
::::: Aldo Bucchi :::::
mobile (56) 8 429 8300

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to