美文网首页
websocket html

websocket html

作者: riane | 来源:发表于2017-08-20 18:20 被阅读0次

var ws = new WebSocket('ws://127.0.0.1:8000/ws');

ws.onopen = function() {

alert("open");

ws.send("WebSocket");

};

ws.onmessage = function(ev) {

alert(ev.data);

};

ws.onclose = function(ev) {

alert("close");

};

ws.onerror = function(ev) {

alert("error");

};

相关文章

网友评论

      本文标题:websocket html

      本文链接:https://www.haomeiwen.com/subject/ujofdxtx.html