<html>
<head>
<title>test</title>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/socketcluster-client/7.0.1/socketcluster.min.js"></script>
$(function () {
test();
});
var socket = socketCluster.connect( {
port: 端口,
hostname: "服务器地址(193.168.18.xxxx)",
path: '/feed/78FF0A0F-34CF-4AA2-9DC2-BD308D3657D2',
secure: false
});
function test(){
console.log('connected');
var sub = socket.subscribe('zdr-m32');
sub.watch(function (data) {
console.log(data);
});
var sub2 = socket.subscribe('zdr-domain');
sub2.watch(function (data) {
console.log(data);
});
}
</script>
</head>
<body>
<button type="button" onclick="test()">点击这里</button>
</body>
</html>
socketcluster 客户端请求
最新推荐文章于 2024-09-11 00:05:05 发布