How does the live, real-time typing work in Google

2019-03-07 23:20发布

I'm sure Wave doesn't poll the server every millisecond to find out if the other user has typed something... so how can I see what the other person is typing as they type? And without hogging the bandwidth.

9条回答
你好瞎i
2楼-- · 2019-03-07 23:56

Pure speculation but could it be using the Server Side DOM events from the HTML 5 spec?

查看更多
手持菜刀,她持情操
3楼-- · 2019-03-07 23:58

the entire reason for WebSockets is to have the browser keep a bi-directional socket open to a server so that real time communications can be used. When someone types on the other end, in a wave client, it triggers an event that is sent to the server and the server in turn looks to see who should also receive the event and pass them the event, in this case the typed letter.

WebSocket and Comet are different.

Granville

查看更多
迷人小祖宗
4楼-- · 2019-03-07 23:59

Probably comet for now websocket in the future. Because it works in Firefox 3.5 and from what I've read the websocket is only available in the nightly builds of FF... I could be wrong though... as it appears to not work in IE at all.

查看更多
The star\"
5楼-- · 2019-03-08 00:02

Server Push in GWT

Server push is the Wait, Respond, Close, Re-Open paradigm:

  • Wait: When the GWT code makes a call to your server for some data that you don't have yet, freeze (wait)

  • Respond: Once the requested data is
    available, respond with it

  • Close: Then, close the connection.

  • Re-Open: Once your GWT code receives the response, immediately open up a new connection to query for the next event.

查看更多
放我归山
6楼-- · 2019-03-08 00:04

Persistent HTTP, Comet

Keep your HTTP connection alive and send characters as they are typed

*Edit in 2014: also, take a look at WebSocket and HTTP/1.1 Upgrade header. Browsers started implementing this around 2010, so I'm adding this to original answer.

查看更多
【Aperson】
7楼-- · 2019-03-08 00:12

See Video Google Wave: Powered by GWT around at minute 55 (near the end)

Q: How you implement the persistent Connections, the long living http connections

A: Future Plan: HTML5 Web Sockets. Longer term. That's what we use at the moment.

Q: Is there a platform or library for this we can download and play with?

A: Not sure. Don't think so

P.S.: That's what he said. To me it did not make much sense ("future plans" vs "using at the moment"). Any native english speaker might want to verify if I transcribed it correctly?

查看更多
登录 后发表回答