奇怪的websocket行为:只有在关闭标签时才发送数据 [英] Weird websocket behavior: only send data when close the tab

查看:131
本文介绍了奇怪的websocket行为:只有在关闭标签时才发送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有没有遇到过这种奇怪的情况。我正在使用由warmcat.com最新版本提供的libwebsocket来支持chrome 20.连接正确打开时没有任何错误(控制台日志中没有任何错误),但是当我调用HTML5 Websocket的connection.send()方法时,没有任何事情发生(也没有在控制台日志中)。只有当我关闭标签页或浏览器时,数据才会立即发送到libwebsocket服务器。



我已经在Chrome 19和Firefox 12中测试过,同样的症状也适用。

有趣的是我有一台安装了Window XP Home和Chrome 19的主机(与主机相同的版本,我的主机运行Windows 7)。当我在该访客机器上尝试使用HTMl5 Websocket时,一切都很顺利@ _ @

解决方案

我一直在遇到这个问题最近6个月左右,它会随机启动一天,影响本地Windows计算机上的所有标准浏览器。

一个WebSocket连接数据的9/10次只能流向一个方向,我尝试过安装很多浏览器,它们都是这样做的。我唯一的解决方案是使用任何运行在linux虚拟机上的浏览器。有趣的是,现在嵌入到Source游戏引擎中的最新Webkit浏览器已经更新,它与游戏中的WebSockets完美结合(即使Webkit Chrome在同一台机器上使用不会)



我唯一的结论是,这是一个非常奇怪的Windows错误,唯一的解决方案是格式化!


have you ever encountered this weird situation. I'm playing with libwebsocket provided by warmcat.com newest version to support chrome 20. THe connection was opened correctly without any error (nothing in console log) but when I call connection.send() method of HTML5 Websocket, nothing happen (also nothing in console log). Only when I close the tab or the browser, the data is sent immediate to libwebsocket server.

I've tested in Chrome 19 and Firefox 12, the same symptom applies.

Interesting is I have a vmware guest machine which has Window XP home and Chrome 19 installed (same version as host machine, my host machine runs Windows 7). When I try HTMl5 Websocket in that guest machine, everything goes just fine @_@

解决方案

I have been experiencing this issue for the last 6 months or so, it started randomly one day, affecting all standard browsers on my local windows machine.

9/10 times a WebSocket connects data only flows one direction, I have tried installing many browsers and they all do the same. My only solution is to use any browser running in a linux virtual machine.

Interestingly enough, now that the latest Webkit browser that is embedded into the Source game engine has been updated, it works perfectly with WebSockets in the game (even though the Webkit Chrome is using on the same machine does not)

My only conclusion is that this is some very strange Windows bug and the only solution is to format!

这篇关于奇怪的websocket行为:只有在关闭标签时才发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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