初始化CRICS
This commit is contained in:
24
WebSite/Scripts/wss.js
Normal file
24
WebSite/Scripts/wss.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const options = {
|
||||
|
||||
clientId: 'mqttjs_' + Math.random().toString(16).substr(2, 8),
|
||||
username: "blwws",
|
||||
password: "E!9~3~H=M.&2STW",
|
||||
protocolVersion: 5
|
||||
};
|
||||
const client = mqtt.connect("wss://gua.blv-oa.com:8084/mqtt",options);
|
||||
|
||||
var hghg=$("#CurrentHotelID").val();
|
||||
client.on("connect", (error) =>
|
||||
{
|
||||
console.log("连接上了");
|
||||
client.subscribe("blw/upgrade_progress/report/"+hghg, (err) =>
|
||||
{
|
||||
});
|
||||
});
|
||||
|
||||
client.on("message", (topic, message) => {
|
||||
var data=message.toString();
|
||||
console.log(data);
|
||||
var jsondata=JSON.parse(data);
|
||||
mqtt_data(jsondata);
|
||||
});
|
||||
Reference in New Issue
Block a user