开发者

Real time web services

开发者 https://www.devze.com 2022-12-29 00:51 出处:网络
I have a little (maybe the answer could require a book) question about web services and server side programming.

I have a little (maybe the answer could require a book) question about web services and server side programming.

But first, a little preamble. Recently we have seen new kind of applications & games using some kind of real-time interaction with a database, or more generally, with other users. I'm talking about shared drawing canvas, games like this , or simple chats, or the Android app "a World of Photo", where in real time you see who is online, to share your photos, etc.

Now my question: Are all these apps based on classic TCP client/server architectures or is there a way to make them in开发者_C百科 a simpler way, like a web platform like LAMP?

What I'm asking, in other words is: Can PHP+MySQL (or JSP, or RoR, or any other server language) provide a way to make online users communicate in real time and share data? Is there a way to do that without the ugly and heavy mechanism of temporary tables?

Thank you! I hope I've been clear.


There is this crazy black magiccy thing called P2P (peer-to-peer) that makes all of this possible.

I don't know, but I don't think it will catch on.

8-D


EDIT: CRAP....I didn't see the date the question was posted.

I can't believe it. This is my third consecutive question that involves XHR Long Polling aka Comet programming. Daliz, what you want is possible, easy and been done by various websites using XHR Long Polling.

The concept: Normally, web browsers send a request to the server, server sends a response back and closes the connection to the browser. Instead of closing the connection at the end, Comet programming keeps the connection open. So, the connection between the browser and the server is still open. So, in simple terms, when we want to connect to Alice, we find the thread connecting to her browser and send the message to Alice.

Facebook chant uses the same concept. Please read This.

If your client is not a web browser but some web service, then it is more easy. Web services unlike web browsers have an address. So, client service calls the main service with a callback URL and registers to a particular event. When that event happens, like someone drawing something, main service will use the callback url of the client service to notify about that action.

On sharing data like Photos or another binary data: it is also possible as the input stream from one user is send to all other related users. So a simple String or a photo can be shared. But it also means the user on the receiving end of the photo will not have a message like "xxx has sent you a photo. Click here to download it". They will simply get a "Do you want to open or save this file" option.

0

精彩评论

暂无评论...
验证码 换一张
取 消