>
<head>
<script src='https://cdn.bootcss.com/socket.io/2.0.3/socket.io.js'></script>
<script>
// 如果服务端不在本机,请把127.0.0.1改成服务端ip
console.log('成立');
var socket = io('http://39.106.121.125:3120');
// 当连接服务端成功时触发connectfunction(){
console.log('connect success');
});
</script>
</head>
<body>
</body>
</html>
```
服务端message from server事件
$io->emit('chat message from server', $msg);
});
});
Worker::runAll();
```
服务器启动该