Skip to content

Commit cd8d1ab

Browse files
authored
Merge pull request #6668 from FlowFuse/remove-ws-dependency-for-remote-instances
Remove WebSocket communication handling and associated methods from the immersive device editor
2 parents c5d47e2 + 75d80b9 commit cd8d1ab

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

frontend/src/pages/device/Editor/index.vue

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,8 @@ export default {
201201
device (device) {
202202
if (device && this.isEditorAvailable) {
203203
this.setContextDevice(device)
204-
this.pollDeviceComms()
205204
this.runInitialTease()
206205
} else {
207-
this.closeComms()
208206
this.$router.push({ name: 'device-overview' })
209207
.then(() => Alerts.emit('Unable to connect to the Remote Instance', 'warning'))
210208
.catch(e => e)
@@ -232,9 +230,6 @@ export default {
232230
})
233231
.catch(err => err)
234232
},
235-
beforeUnmount () {
236-
this.closeComms()
237-
},
238233
methods: {
239234
...mapActions('context', { setContextDevice: 'setDevice' }),
240235
loadDevice: async function () {
@@ -251,30 +246,6 @@ export default {
251246
252247
// todo we first need to get the device and set the team afterwards
253248
await this.$store.dispatch('account/setTeam', this.device.team.slug)
254-
},
255-
pollDeviceComms () {
256-
if (!this.isEditorAvailable || this.ws) return
257-
258-
const uri = `/api/v1/devices/${this.device.id}/editor/proxy/comms`
259-
260-
this.ws = new WebSocket(uri)
261-
262-
this.ws.addEventListener('error', this.handleCommsDisconnect)
263-
this.ws.addEventListener('close', this.handleCommsDisconnect)
264-
},
265-
handleCommsDisconnect (event) {
266-
console.warn(event)
267-
this.$router.push({ name: 'device-overview' })
268-
.then(() => Alerts.emit('Disconnected from remote instance.', 'warning'))
269-
.catch(e => e)
270-
},
271-
closeComms () {
272-
if (this.ws) {
273-
this.ws.removeEventListener('error', this.handleCommsDisconnect)
274-
this.ws.removeEventListener('close', this.handleCommsDisconnect)
275-
this.ws.close()
276-
this.ws = null
277-
}
278249
}
279250
}
280251
}

0 commit comments

Comments
 (0)