I've seen on Facebook where if your friend types in the Chat, you are told they are typing.
I've seen it on various CHAT services where you are told if they are chatting.
How is this done? As they are on separate browsers. I am working on something where this function would be rather useful.
Many thanks
Can PHP tell if someone is typing?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Can PHP tell if someone is typing?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can PHP tell if someone is typing?
PHP itself cannot tell this. It is completely executed on the server. To accomplish this, you need to use AJAX that monitors the input and sends requests back to the server and tracks the status somehow. It also needs periodically check back with the server to get the status from other people to indicate if they are typing or not.
Keep in mind things like server load. If you have 5 people, even if it is only doing the requests only every 30 seconds, that is 20 requests PER MINUTE to the server (and that many calls to resources that are tracking status, ie database calls, etc)
This is why I always outsource chat services to 3rds parties that are designed to handle it.
Keep in mind things like server load. If you have 5 people, even if it is only doing the requests only every 30 seconds, that is 20 requests PER MINUTE to the server (and that many calls to resources that are tracking status, ie database calls, etc)
This is why I always outsource chat services to 3rds parties that are designed to handle it.
Re: Can PHP tell if someone is typing?
Thats good advice twinedev, and you are right to outsource that need because even the larger companies such as BT, O2, Vodaphone, etc etc outsource this.
It does depend on your actual projected use of this requirement because if you know you are only going to have say 5 people max using it then you could handle those requests. But if your goals are to get more and more people using it such as Messenger, Skype etc then you make a choice of whether to get your own large servers or outsource.
Best wishes
It does depend on your actual projected use of this requirement because if you know you are only going to have say 5 people max using it then you could handle those requests. But if your goals are to get more and more people using it such as Messenger, Skype etc then you make a choice of whether to get your own large servers or outsource.
Best wishes
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Can PHP tell if someone is typing?
We don't think the demand will be high.
The thing is, I can use Ajax to do all sorts of things, but how do you use 'keydown' on one persons client-side browser, and then show "Fred is typing..." on the other persons?
If would be useful to at least try it. If demand gets high, then we can withdraw it.
The thing is, I can use Ajax to do all sorts of things, but how do you use 'keydown' on one persons client-side browser, and then show "Fred is typing..." on the other persons?
If would be useful to at least try it. If demand gets high, then we can withdraw it.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Can PHP tell if someone is typing?
Hi,
Facebook is using an Ajax technique called COMET, which holds the HTTP connection to the server as long as possible, to accomplish this.
Greets.
Facebook is using an Ajax technique called COMET, which holds the HTTP connection to the server as long as possible, to accomplish this.
Greets.