Web: also subscribe to current job when webapp starts
This commit is contained in:
parent
e9e1cd8be8
commit
03b880fdb3
@ -60,9 +60,10 @@ export default {
|
|||||||
// console.
|
// console.
|
||||||
window.ws = ws;
|
window.ws = ws;
|
||||||
|
|
||||||
this.socket.on('open', (error) => {
|
this.socket.on('connect', (error) => {
|
||||||
console.log("socketIO connection open");
|
console.log("socketIO connection established");
|
||||||
this.sockStatus.connected();
|
this.sockStatus.connected();
|
||||||
|
this._resubscribe();
|
||||||
});
|
});
|
||||||
this.socket.on('connect_error', (error) => {
|
this.socket.on('connect_error', (error) => {
|
||||||
// Don't log the error here, it's too long and noisy for regular logs.
|
// Don't log the error here, it's too long and noisy for regular logs.
|
||||||
@ -97,9 +98,7 @@ export default {
|
|||||||
this.socket.on("reconnect", (attemptNumber) => {
|
this.socket.on("reconnect", (attemptNumber) => {
|
||||||
console.log("socketIO reconnected after", attemptNumber, "attempts");
|
console.log("socketIO reconnected after", attemptNumber, "attempts");
|
||||||
this.sockStatus.connected();
|
this.sockStatus.connected();
|
||||||
|
this._resubscribe();
|
||||||
// Resubscribe to whatever we want to be subscribed to:
|
|
||||||
if (this.subscribedJob) this._updateJobSubscription("subscribe", this.subscribedJob);
|
|
||||||
|
|
||||||
this.$emit("sioReconnected", attemptNumber);
|
this.$emit("sioReconnected", attemptNumber);
|
||||||
});
|
});
|
||||||
@ -143,9 +142,14 @@ export default {
|
|||||||
|
|
||||||
_updateJobSubscription(operation, jobID) {
|
_updateJobSubscription(operation, jobID) {
|
||||||
const payload = new API.SocketIOSubscription(operation, "job", jobID);
|
const payload = new API.SocketIOSubscription(operation, "job", jobID);
|
||||||
console.log("sending job subscription:", payload);
|
console.log(`sending job ${operation}:`, payload);
|
||||||
this.socket.emit("/subscription", payload);
|
this.socket.emit("/subscription", payload);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Resubscribe to whatever we want to be subscribed to:
|
||||||
|
_resubscribe() {
|
||||||
|
if (this.subscribedJob) this._updateJobSubscription("subscribe", this.subscribedJob);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user