我可以在 html5 websockets 中同时向服务器发送数据吗?
例如 :
$(document).ready(function () {
conn = {}, window.WebSocket = window.WebSocket || window.MozWebSocket;
connection1();
});
function connection1() {
// uses global 'conn' object
if (conn.readyState === undefined || conn.readyState > 1) {
conn1 = new WebSocket('ws://ip1:8101');
//connection open
conn1.onopen = function () {
conn1.send("Connection1 Established Confirmation");
}
};
conn1.onmessage = function(message){
conn1.send("data1");
conn1.send("data2");
conn1.send("data3");
conn1.send("data4");
};
}
data1,data2,data3,data4 需要一次发送到服务器。谢谢,