How is “Someone is typing a comment...” implemented in Facebook?

1 Answer

Answer :

answer:I am a software engineer; I do not know how Facebook actually implements this but here’s how it could be done: Say you’re at your computer looking at a Facebook post. When you start to type in the comment box, your browser knows that the contents of the box have changed. Usually, this information does not need to be communicated to Facebook’s servers in order to “publish” this comment until you hit the “post” button. However, to implement the feature you described, you could bind an “action listener” to the text box. This is basically a function that gets triggered any time the contents of the box change. The action listener could then send an ajax call up to the server. Ajax calls are asynchronous (that’s what the first A stands for), meaning that the call can happen “in the background” while you’re still doing whatever you’re doing, so it doesn’t interrupt your typing. The ajax request can then go talk to the server and give an indication that the contents of the text box are changing. So, we know this probably means someone is typing. In order to optimize this so that the server doesn’t get bogged down with billions of requests every second, I would guess that the action listener filters out most changes before talking to the server. That is, we don’t care if the contents of the text box just changed from “Hi” into “Hi Judy,” but we do care if the text box just went from empty to non-empty, or vice versa, as these are the indicators that someone has either just started or just stopped typing.

Related questions

Description : Can someone please explain to me exactly how PHP, mySQL, Javascript, and HTML/CSS are related?

Last Answer : PHP is a serverside language, while JavaScript and mySQL are clientside languages. I think the difference is that PHP/HTML is the language used by the server to encode instructions for the web browser, ... have no idea whether it's accurate or not. I just started learning this stuff this week.

Description : What is a fair price to charge someone to advertise on your blog?

Last Answer : Projections really don't mean much. Advertisers are concerned with what your current traffic is averaged over the previous year. With 150 hits a day (as a side note, advertisers want to know ... they are getting since I would imagine there are hundreds of sites in the bridal category to compare.

Description : What's with the Captcha Widgets that won't Captcha?

Last Answer : I don't know if this is new, or just new to me, but I encountered a captcha the other day that was, Spell out the following sequence of numbers, in text followed by a random string of numbers, ... 3 9. It was so EASY! No bizarre distorted images of words that are either obscure or not even real.

Description : Where is the tag located in safari?

Last Answer : The tag is part of the page's source code. It is not located in Safari. You can view the source code in Safari (probably using Ctrl-U) but you probably can't edit it. In order to do ... files- HTML is pretty simple. Otherwise, I recommend getting someone else to do the edits for you. Good luck!

Description : How to install google analytics on wix?

Last Answer : answer:Try reading the F$%^King manual Here is the Wix dot com answer

Description : Hey SEO's & Web Guys... Is this a good price for SEO?

Last Answer : The developer is getting the short end of the stick, big time. So yes, you’re walking of with one hell of a deal.

Description : Is this a ridiculous estimate for SEO work?

Last Answer : answer:Welcome to Fluther, first of all. As to your question who knows? It might be ridiculously low, or it might be ridiculously high. It might be right in the middle of all the estimates you could ... of costs and of what the return on your investment may be before you get on your high horse?

Description : Where can i find a tutorial on how to make a website with logins and usernames (without cms)

Last Answer : answer:http://net.tutsplus.com/tutorials/php/user-membership-with-php/ There is no simple way around this. You are going to need to know how to set up a database and know a bit of PHP. Adding a ... day. It might be worth it to just hire someone to do it for you. Opportunity costs and all that.

Description : Can I create on twitter a broadcast personalized for one my specific followers?

Last Answer : No

Description : How can I easily create a website like Fluther without knowing webdesign?

Last Answer : answer:That IS a B-R-I-L-L-I-A-N-T idea! A single topic forum… WOW! I think you’re really on to something big! Good Luck Friend!

Description : Does anyone know a good, open-source IDE for the Mac?

Last Answer : I heart Komodo Edit (though I’m mostly a python progammer). You’d find a lot of use out of Eclipse, though I got sick of it after a while.

Description : Why are content management frameworks like Drupal so much more popular than MVC framework like CakePHP, but so much less fun to develop with?

Last Answer : I’m not sure what your question is. It’s the responsibility of an experienced developer to pick the framework that best suits the site he’s trying to build. There are many options because there are many types of sites, and there’s no single best solution for all problems.

Description : How to integrate social web sites together?

Last Answer : You can convert your blog to a planet then load the RSS feeds. You can aggregate the information on Plaxo Pulse, FriendFeed or similar websites (and perhaps aggregate those into your blog). Yahoo! Pipes might ... edge and lend me a hand in testing my software that's designed to do exactly this ;-)

Description : Wiki software with an iPhone (or easily customisable) interface?

Last Answer : I use http://wapedia.mobi/ It pulls all the pages from en.wikipedia.com/ so it’s the same thing. If you want to edit articles from your phone you have to turn that on via options on the site when your on your phone. Best of luck.

Description : Hey all you mac web developers, what FTP program do you use?

Last Answer : Transmit, by Panic.

Description : How can I make images easier to use in Drupal for my users?

Last Answer : Here are some links that might be helpful: http://groups.drupal.org/node/5328 http://drupal.org/node/58685 I’m hoping someone else will have something good to add as I have noticed this too.

Description : What does a person need to set up a website that requires a login and to upload videos and let other users ,too?

Last Answer : depends. what do you want to do with said website?

Description : What's the next step after I create a web hosting account?

Last Answer : answer:After creating your web hosting account you're going to upload your files there (the html, css, javascript, etc) the methods available to upload vary from host to host but usually they'll ... luck at the sitepoint forums for specific questions. Hope the resources help and good luck with it.

Description : How do you compute "popularity"?

Last Answer : weigh time.

Description : In Drupal, can I access FormAPI from a Block?

Last Answer : Sure. Use a PHP block and you can pretty much do whatever you like. You can access the form API from anywhere, just follow the API specs.

Description : Are there any Web services available for free to retrieve the definitions of words?

Last Answer : http://www.dictionary.com and if you want slang words http://www.urbandictionary.com

Description : How do I build a website where people can talk to each other?

Last Answer : The software you would use would be here or you could use the exact one they're using by getting it here . As far as what you need to do and know. You need to know websites, how to ... all relatively cheap. I wont plug any particular one, except to say that GoDaddy's interface blows banana balls.

Description : Can I license ask-public.com's technology?

Last Answer : answer:What exactly are you trying to do? Anyways, you might try PMing Ben or Andrew, the site founders (owners?). They might be able to get you the information you need. You could also use the contact page to get in touch…

Description : What CMS do you prefer? (and why?)

Last Answer : I’ve used Druapl for a few projects. If you can get over the fact that it’s written in PHP4, it’s not too bad. The nicest thing about it are all the contributed modules.

Description : What’s a comment you never got to submit because the post got locked while you were typing?

Last Answer : "I don't understand why people are so interested in talking to a machine. It's just a waste of time."

Description : How do you make the font different on myspace when typing a message or comment?

Last Answer : answer: text to make bold italic text underline text TEXT through TEXT one being the smallest and 7 being the largest.

Description : How do I undo erasing a message I was typing on Facebook?

Last Answer : answer:This may be one of the SOL times…. On my phone If I push the “back” button auto save…....On my PC a “draft saver” but other than that….Check in the “browser cache”....?

Description : With Facebook, when I comment on someone else's link, how can I set it so that it doesn't show up in my newsfeed?

Last Answer : Just to verify…do you mean really mean newsfeed? The only one that can read what shows up on that page is you. Or do you mean on your wall (or timeline)? Anyone who has permission see your profile can read anything posted there, unless specific controls are put into place.

Description : How do you "send" a comment on Facebook?

Last Answer : Did you push “post” (directly to the right of the comment bar.)

Description : Do you have any Facebook friends who neither post anything, nor comment or "like" or react in any way to anything you post?

Last Answer : I am one of those people, or at least I was when I had Facebook. The main reason is that I just had nothing to post. Where I go, what I think, what did I wear, who I am with ... tired of Facebook. I just don't care about your statuses and inspirational quotes. And forwarding adds is just annoying.

Description : How do I make my Facebook posts public, but only my Facebook friends can comment on the post I've made..?

Last Answer : It’s in your privacy settings on the upper right.

Description : Atheists: Would you have commented on this Facebook situation? Theists: What are your thoughts on the comment I did make?

Last Answer : answer: I thought I was nice enough about it, but I knew I might be opening a can of worms, and that some discussion might result from it. I wasn't itching for a fight or anything. Just trying ... when you were trying to be friendly and informative, but that's me. I would take that very personally.

Description : On facebook if you comment on someone's post then delete it are they still notified that you wrote it in the first place?

Last Answer : Yes, but when they click on the notification, it takes them to a page that says the comment is no longer available.

Description : On the iPhone application Facebook, Why does it keep giving errors when attempting to submit a comment to someones wall?

Last Answer : It’s a bug. Wait, and try again later.

Description : Does anyone else have comment problem with the iPhone version of Facebook?

Last Answer : No, I’ve never experienced this problem because I just really dislike the iPhone version of Facebook. It’s just way too plain and stripped-down for me. My recommendation to you is to just use the regular Facebook web site on your iPhone as I do on my iPod touch.

Description : Someone wants me to do some personal typing and want to know what much I will charge them. I have never done this type thing so I don't know how to start with a price. Can you give me some ideas?

Last Answer : when I was in college (In the late late 1970’s) I paid $1.00 a page. with inflation it will be more, but it is easier now that you don’t have to start over every time you make a mistake. I would say that you should agree on a “per page” price, and agree in advance about spacing and font size.

Description : I have tendonitis in both elbows. I'm told it's from over typing. I also have osteoarthritis in my neck. Someone said they have the same thing and STEMS helped. What is this?

Last Answer : What I come to understand is that STEMS is a treatment where they actually inject Stem cells in the area which has tendonitis. if you would like more info in regards to treatments that are said to be extremely great for people with tendonitis here is a link below: http://www.weilab.com/index.html

Description : How to address everyone in the "To" bar, without typing them all one by one? See detail.

Last Answer : It depends on what email program you’re using but if it’s gmail and they’re in your address book already, when you type the beginning of their name, the name will pop up for you to click on.

Description : When typing a letter how rare is it to use a symbol?

Last Answer : I always mistype when I have to use an ö.

Description : Where can I learn touch typing on a scandinavian keyboard ?

Last Answer : I would go on the net to an embassy or consulate. My guess is that someone on the clerical staff can steer you toward an answer.

Description : What is the best way to increase my typing speed in a small period of time?

Last Answer : I'm not sure there's a better way than practice. There are some typing games we used in school, looking online there's still quite a few places that have those up. You can play right in the ... It's probably the fastest way as well and is going to make any other practice more beneficial. Good luck.

Description : How would you describe your typing skills?

Last Answer : I type fast. I use all my fingers. I don’t look at the keyboard. I do make mistakes at times. I can’t actually tell you where the keys are. If you said “where is the L on a qwerty keyboard”, I couldn’t tell you without looking. I’m on auto-pilot.

Description : What sound does typing make?

Last Answer : I don’t really think there is anything else that sounds like typing, or if there is, it’s been long forgotten. It’s a pretty specific sort of sound.

Description : Why am I not typing exactly what I mean to say?

Last Answer : Are you distracted by other matters perhaps?

Description : Why does my typing get delayed sometimes on my browser?

Last Answer : Maybe this will help you.

Description : Why is my laptop typing on its own?

Last Answer : I presume you have already vacuumed the keyboard with a crevice tool to get rid of junk that occasionally cause sticky keys. Next, close the top and turn it upside down. You will see 4-6 screws small that ... those screws. As you look at the bottom, I'm guessing the ones in the upper left are loose.

Description : I thought of this question and - voila there it is - without typing it - what's next in telekinesis?

Last Answer : Here’s the board

Description : What is the best way to increase my typing speed by Wednesday?

Last Answer : answer:I’m faster at hunting and pecking due to Mavis Beacon For a while while I used one of the old versions of it regularly, I could even look up from the keyboard. I’m a bit out of practice with looking away, but I can type quite fast with a few more fingers than I used to use.

Description : Why could I be making these errors while typing?

Last Answer : I’ve noticed that if I write one word particularly often, I’ll write it accidentally when I’m meaning to write a word that starts the same way. I’ll start automatically typing the whole word when I type the first few letters.

Description : What 90's typing game am I thinking of?

Last Answer : I’m pretty sure that was the old school version of Mavis Beacon. That’s the only typing game I played as a kid, and I’m pretty sure what you described was the set up. ...unless the set up was two cars racing. I can’t remember for sure.