使用chrome.socket API构建Web服务器 [英] Building web server using chrome.socket API

查看:119
本文介绍了使用chrome.socket API构建Web服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Chrome打包应用程序构建了一个Web服务器。我重复看到的问题是,chrome.socket.accept()和chrome.socket.write()不会调用它们的回调函数。如果请求速率小于每秒1个请求,它通常会或多或少地可靠工作。

I've built a web server using Chrome Packaged Apps. The problem I see repeatedly is that chrome.socket.accept() and chrome.socket.write() don't invoke their callback functions. It usually works more or less reliably if request rate is less than 1 request per seconds. If I go above that, then I start seeing errors or missing callbacks.

我使用谷歌( https://github.com/GoogleChrome/chrome-app-samples/tree/master/webserver )。它有同样的问题。在Web服务器停止响应之前,通常需要的请求少于100个。重现此问题的最简单方法是使用Chrome浏览器作为客户端,并按住F5键几秒钟。

I did similar tests with sample "webserver" app build by Google (https://github.com/GoogleChrome/chrome-app-samples/tree/master/webserver). It has the same problem. It usually takes less than 100 requests before web server stops responding. The easiest way to reproduce the problem is to use Chrome browser as a client and hold F5 key for few seconds.

最好有一个示例应用程序演示使用chrome.socket构建可靠的Web服务器。到目前为止,我尝试了几种不同的解决方法来监视应用程序本身的情况,并在套接字停止工作时重新启动套接字,但这并不容易,因为没有可靠的方法来检查连接的状态或最后一个操作的状态,因为回调不是被解雇。我尝试使用getInfo()方法,但无论情况如何,它总是返回connected = true。

It would be desirable to have a sample app that demonstrates how to build reliable web server using chrome.socket. So far I tried several different workarounds for monitoring the situation from the app itself and restarting socket when socket stops working, but it's not easy because there is no reliable way to check the status of the connection or status of the last operation when callback is not fired. I tried to use getInfo() method, but it always returns "connected=true" regardless of the situation.

我在Windows 7和Chrome OS(Chromebook) 。

I saw this on Windows 7 and Chrome OS (Chromebook).

推荐答案

只需更新即可。根据,问题现已解决。

Just an update on this. According to this the issue is now fixed.

这篇关于使用chrome.socket API构建Web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆