开发者

Comet WEb server implementation

开发者 https://www.devze.com 2023-04-08 09:03 出处:网络
I recently asked one question :- Handle Web Server with multiple clients I have gone through the basic techniques to implement comet server like streamhub,Maven/Jetty etc.

I recently asked one question :- Handle Web Server with multiple clients

I have gone through the basic techniques to implement comet server like streamhub,Maven/Jetty etc. I have following questions for that :

  1. After that I found the issues like in case of Maven/Jetty internet connection is required for downloading certain files from net.So it it possible to implement it if no internet connection is there on machine where the web server is hosted ?

  2. 开发者_如何转开发Also I want the open source tools/technologies to achieve the thing mentioned in the above question. and I think stream hub is not a open source free version. Please help if you know any tool which is free/open source to use.

  3. Currently the web application is running on apache web server. so if I use comet server what changes I need to do in that ??

Please help... Thanks in advance...


For comet, pick a server which can handle many open connections. For a chat app I implemented which currently handles 10k open connections, I used Mochiweb. You might want to give that a look.

Going along the Mochiweb path, I will also recommend Erlang for implementing you server. It will be a small piece of code. Basically, you will listen on a path and hold the connection open till you have some data to respond with or timeout.

On the client side, you would write a simple JS function which will make an AJAX call and handle response timeout and data responses as and when they come. Nothing too different here. However, you may need JSONP instead (crossdomain/subdomain because of different servers for web and long poll), so ensure that your LongPoll server replies accordingly.

0

精彩评论

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

关注公众号