Highlighted

dispatching event between sessions

kingquattro

09-05-2008

Hey guys,

I am pretty much a new bee at flex and action scripting. I
am creating a web app, and one of the requirements is that it has a
messaging system. Not chat session, but something similar to email.




use case:

user A and B are logged at two different location. But are
unaware if other is logged in or not. User A would like to send A
message to B, so a types up a message and sends it, the message is
saved in the DB, and User A dispatches an event. If B is logged in
then its is listening for an event, and hence will know there is a
message waiting. Else when B logs in, it adds an eventListner for
any message, and at the same time fetches all unread messages from
the DB.



Any idea how i can dispatch and listen for event across
sessions?



I know the other way would be to dispatch an event every few
mins that Query's DB for any unread messages, but one I don't want
to do a "busy waiting" on it, secondly if thats the only way how
can I setup an event that is dispatched on clock tick?



Thanks for your help.



Jaysheel



p.s I am using RPC and Coldfusion 8 to interact with my MYSQL
5 DB

Replies

Highlighted

atta707

09-05-2008

The use case you've defined can easily be addressed by using
Timer class that ticks an event after a given timespan and sendinga
HTTPService request to the server on the tick.



For more involved apps BlazeDS has built-in messaging
mechanism:


http://www.adobe.com/devnet/flex/articles/data_entry.html


http://www.adobe.com/devnet/flex/articles/yahoomaps_collaboration.html



ATTA
Highlighted

kingquattro

09-05-2008

Hey ATTA,

Thanks for the reply. Looks like in the collaborative data
enter example you mentioned it required an extra step on the user
end to create a session first, thats some what in the lines for
creating a chat session. Which is what I am trying to avoid. Is it
possible for yourself or anyone on the forum to provide and example
on how to use the Timer class that I can just initiate in my main
application .mxml page, and then at every time interval (say 5min
for now) it will dispatch and rpc call to the CF server, and the
result Handler will deal with the rest.



Thanks again for everyones help on this.



Jaysheel.
Highlighted

kingquattro

09-05-2008

Thanks for all your help. I did a bit more digging and found
that you cannot do real time data transfer, if using Flash Remoting
to communicate with server-side code. Flex Data Service is
required, and I don't have time to explore that nor the money to
setup a Flex Data Service server. So using Timer class and checking
at every time interval (which I didn't want to do) is the only way
to go. Thanks ATTA for your examples I will use them to move
forward. If I have some spare time later on I will give Flex Data
Service a try.