嗨,在我的 android 应用程序中,我在 jquery 中使用 websocket
我尝试使用此脚本连接连接 websocket
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.mobile-1.0a2.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="cordova-1.8.0.js"></script>
这是我用来连接 websocket 的代码
var ITOUCH_WEBSOCKET = {"remote_address":'ws://atwerervgt',"channel":'alert'};
(function pulse(websocketDetails){
if ("WebSocket" in window)
{
alert("Websocket is supported");
// Let us open a web socket
var ws = new WebSocket(websocketDetails.remote_address,websocketDetails.channel);
ws.onmessage = function (evt)
{
}
createAlert(received_msg,received_msg.actionType==='NEW');
} else {
// alert("Message Received : Action Type is " + received_msg.actionType);
}
};
ws.onclose = function()
{
// websocket is closed.
//alert("Connection is closed...");
// On close reconnect again
pulse(websocketDetails);
};
}
else
{alert("Websocket is not supported");
}
})(ITOUCH_WEBSOCKET);
});
我收到的警报是不支持 Websocket
谁能帮我我的websocket编码有什么问题