📜  javascript websocket 示例代码 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:46.789000             🧑  作者: Mango

代码示例2
var Socket = new WebSocket('ws://' + window.location.hostname + ':81/'); // The '81' here is the Port where the WebSocket server will communicate with
// The instance of the WebSocket() class (i.e. Socket here), must need to be globally defined

Socket.send("pass your data here, and it'll be String"); // This method one can call locally