service file
This commit is contained in:
18
smartclient.service
Normal file
18
smartclient.service
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=smartclient
|
||||||
|
Wants=network-online.target
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
GuessMainPID=yes
|
||||||
|
ExecStart=/usr/bin/npm run server
|
||||||
|
ExecStop=kill -SIGINT $mainpid
|
||||||
|
Restart=on-failure
|
||||||
|
WorkingDirectory=/opt/services/smartclient
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
Alias=smartclient
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -9,7 +9,7 @@ export class MqttclientService {
|
|||||||
private callbacks : Map<string, callbackFunc> = new Map()
|
private callbacks : Map<string, callbackFunc> = new Map()
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.mqttClient = Mqtt.connect('ws://127.0.0.1:9001')
|
this.mqttClient = Mqtt.connect('ws://172.16.2.16:9001')
|
||||||
this.mqttClient.on('connect', () => {
|
this.mqttClient.on('connect', () => {
|
||||||
console.log('MQTT connected')
|
console.log('MQTT connected')
|
||||||
this.callbacks.forEach((value: callbackFunc, key: string) => {
|
this.callbacks.forEach((value: callbackFunc, key: string) => {
|
||||||
|
Reference in New Issue
Block a user