How do I work with the TypingEvent? (or some other using typing event)

2 views
Skip to first unread message

Chris

unread,
Apr 21, 2009, 9:04:46 AM4/21/09
to wimas3
Hello,
I've had good success creating a basic chat interface. Awesome!! Now
I'm getting into some of the finer details. Detecting when the other
user is typing is the current challenge. The following code has not
produced any errors, but is not reporting when the other user (AIM non-
flash client) is typing. Is there something else I should be looking
at?

Here is the code:

...
import com.aol.api.wim.events.TypingEvent;
import com.aol.api.wim.data.types.TypingStatus;
...
session.addEventListener(TypingEvent.TYPING_STATUS_RECEIVED,
onTypingEvent);

function onTypingEvent(evt:TypingEvent):void {
trace('yay your friend is typing!');
}


Am I missing any key pieces? Thanks much for the assist!

Chris

unread,
Apr 25, 2009, 10:13:22 AM4/25/09
to wimas3
Howdy,
I'm still pondering this issue. Any thoughts on how to detect when
another user is typing?

Thanks again in advance. I truly appreciate the pointers. :)

Rizwan Sattar

unread,
Apr 25, 2009, 2:01:46 PM4/25/09
to wim...@googlegroups.com
Hi Chris!

Sorry for the late response. Are you still not receiving any typing events? Which clients are you using? Regular AIM clients and even libpurple clients should be sending typing events correctly. You have to have at least one exchange (1 msg sent, 1 received) to start receiving typing events, I believe.

The way it's supposed to work is that when you receive a TypingEvent.TYPING_STATUS_RECEIVED, you check the event.typingStatus. It is a string, and you should compare it to com.aol.wim.data.types.TypingStatus.

In general, the typing events are received like this:

1) TypingStatus.TYPING, then receiving an IM (go and clear the typing status on your end to TypingStatus.NONE)
2) TypingStatus.TYPING, then TypingStatus.TYPED - the user was typing, then they stopped for at least 3 seconds.
3) TypingStatus.TYPING, then TypingStatus.NONE - the user was typing, then deleted their entire message before sending (i.e their input field is now empty).

Similarly to implement sending TypingStatus correctly follow the rules above, which are:

1) When the user changes your input field to non-empty, send TypingStatus.TYPING. Also start/reset a timer for 3 seconds every time the user adds text.
2) If the timer fires, it means the user stopped typing for 3 seconds, so send TypingStatus.TYPED.
3) If the user clears the input field (before sending), send TypingStatus.NONE, and clear your 3-second timer.
4) If the user sends the message, clear your 3-second timer, and clear the text. No need to send TypingStatus.NONE.

I believe those are the main cases to handle. If you implement this correctly, the typing status will show in other AIM clients correctly. You can always test your typing status behavior against iChat (if you are on OS X, or the regular desktop AIM client, on Windows).

Thanks for using wimas3 - it's much appreciated. When you finish whatever you're doing, drop us a link to your app, and we'll put a link to it on the home page of wimas3!

Oh, and I'm planning to push a big update to wimas3 (group chat support!) soon. To get a preview for what you can do, try out the new version of AIM Express (www.aimexpress.com), sign in, and then from the Menu, click "Create Group Chat...". It's still in beta, but I think it's pretty cool!

-Rizwan

Chris

unread,
Apr 25, 2009, 3:25:59 PM4/25/09
to wimas3
Hello Rizwan,
Thank you for the response, and an awesome wimas3! I've been toying
with random chat for Flash, and this is by far the best and easiest to
work with, especially since I can use it in Flash CS3 (just checking,
that's not part of the problem is it?). I'll be sure to post a blog
with code to share when this is finished. I'm in the process of making
a very basic, personal "customer support" style chat with some
screening options to prevent harassment.

So far, I'm unable to detect and echo a simple "yo!" for
TypingEvent.TYPING_STATUS_RECEIVED. I can handle IMEvents and others,
but nothing for typing (using code in first post above). Generally I
use Adium, but tried iChat as a testing client (thanks for the tip!),
able to send messages back and forth. No luck with typing event.
Despite a horrid looking interface and not detecting the typing event,
everything is good to go for what I need. Would it help if I provide a
complete example?

Thanks for the info regarding the workings of typing events. I will
include those in there when things are working.

Rizwan Sattar

unread,
Apr 25, 2009, 3:47:39 PM4/25/09
to wim...@googlegroups.com
Hmm as far as I can tell, wimas3 is registering you for the "typing" event, so you should be receiving it. Can you test against AIM Express (as the typing status sender), to verify whether it is working or not?

http://www.aimexpress.com/

The only other thing I can think of is that anonymous sessions (WIMZI) don't support typing status. Does typing status work for other (non WIMZI) clients? I will try and verify this on Monday with the AIM server folks.

Thanks,
Rizwan

Chris

unread,
Apr 25, 2009, 4:09:33 PM4/25/09
to wimas3
Rizwan,
Hmm. No luck with with AIM Express typing received by Flash either,
but I love the blur effect when new messages come in on that client.
Back on topic though, I am able to broadcast typing events to AIM
Express from Flash. I'm fiddling with the timer now - so it's at least
working one way! :)

Let me know what you come up with. In the meantime I'll keep messing
around with it. With my luck I'm missing a "." or something small
somewhere.

Thank you,

Chris

Osman Ullah

unread,
Apr 25, 2009, 8:26:38 PM4/25/09
to wim...@googlegroups.com
Are you sure both sides of the conversation have sent an IM to each
other? I do not think you will receive typing events from someone
unless both sides have sent at least one IM to each other.

Chris

unread,
Apr 27, 2009, 8:54:19 AM4/27/09
to wimas3
Hello Osman,
Yes, two-way conversations are taking place without typing event
function being triggered in Flash. The order of events take place in
this order:
1. Visitor types in a nickname, then submits, which starts and
anonymous login.
2. Once logged in, an automated message is sent to my aim account. If
I reply with 1, the chat is accepted
3. Flash reads the reply of 1, goes to the chat frame, and the
conversation begins.
4. Chats go back and forth. Fun conversations are had. Typing events
are being sent from Flash ok as scripted, but are not being received.

All the functions are defined on the first frame. I'll be happy to
provide a stripped down, working example fla file. I'm preparing this
now.

Thank you,

Chris

On Apr 25, 6:26 pm, Osman Ullah <osman.ul...@gmail.com> wrote:
> Are you sure both sides of the conversation have sent an IM to each
> other? I do not think you will receive typing events from someone
> unless both sides have sent at least one IM to each other.
>
Reply all
Reply to author
Forward
0 new messages