|
|
@ -370,25 +370,25 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
// });
|
|
|
// });
|
|
|
|
|
|
|
|
|
// 事件绑定
|
|
|
// 事件绑定
|
|
|
client.on('connect', () => { |
|
|
// client.on('connect', () => {
|
|
|
console.log('Connected'); |
|
|
// console.log('Connected');
|
|
|
client.subscribe(['/wcs_server/' + item.id], { qos: 0 }); |
|
|
// client.subscribe(['/wcs_server/' + item.id], { qos: 0 });
|
|
|
client.publish('/agv_robot/status', 'online', { retain: true }); |
|
|
// client.publish('/agv_robot/status', 'online', { retain: true });
|
|
|
}); |
|
|
// });
|
|
|
|
|
|
//
|
|
|
client.on('message', (topic, msg) => { |
|
|
// client.on('message', (topic, msg) => {
|
|
|
console.log(`[${topic}] ${msg}`); |
|
|
// console.log(`[${topic}] ${msg}`);
|
|
|
const a = JSON.parse(msg.toString()); |
|
|
// const a = JSON.parse(msg.toString());
|
|
|
this.handleMessage(a); |
|
|
// this.handleMessage(a);
|
|
|
|
|
|
//
|
|
|
}); |
|
|
// });
|
|
|
|
|
|
//
|
|
|
client.on('error', (error) => { |
|
|
// client.on('error', (error) => {
|
|
|
console.error('Error:', error); |
|
|
// console.error('Error:', error);
|
|
|
}); |
|
|
// });
|
|
|
} catch (e) { |
|
|
// } catch (e) {
|
|
|
console.error(e) |
|
|
// console.error(e)
|
|
|
} |
|
|
// }
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|