Fix #99410: SocketIO Reconnect Web Interface #104235
No reviewers
Labels
No Label
Good First Issue
Priority
High
Priority
Low
Priority
Normal
Status
Archived
Status
Confirmed
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Job Type
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: studio/flamenco#104235
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Evelinealy/flamenco:socketio-web-interface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fix #99410: Web interface: fetch version on SocketIO reconnect (and maybe reload)
A feature implement where after losing the SocketIO connection and subsequently reconnecting, the webapp should re-fetch the Flamenco Manager version and display it in the top-right corner. If it's different from before, then it will log a notification about the upgrade and refresh the entire page to ensure the new version is loaded properly.
WIP: SocketIO Reconnect Web Interfaceto WIP: Fix #99410: SocketIO Reconnect Web InterfaceThe WIP is just to show that I haven't finished yet, but I wanted to put up a small change so you could guide me in the right direction. I do believe I'm in the right file. I am actively working on this and hope to finish by tomorrow or Monday (depending on my schedule). We can talk more on the call, though.
I think the code is ok, but it shouldn't be in
JobsView.vue
. This behaviour should be implemented for the entire web interface, and not just for the "Jobs" tab. Putting this inApp.vue
would be better. There is already code there that can fetch the Flamenco version. I think a good approach would be:this.flamencoVersion
andthis.flamencoName
to see if a reload is necessary.WIP: Fix #99410: SocketIO Reconnect Web Interfaceto Fix #99410: SocketIO Reconnect Web InterfaceI don't even want to begin to address all these commits... I messed up with the git pull. So, for now, until if I figure out the best way to squash this without deleting anybody's progress, I'll just write what I did in here (it's very small).
This is the hardest part and I'm still not 100% sure with SocketIO, but in the mounting, I was just trying to get some sort of connection to make an event listener. It was originally named "$socket" for a placeholder, but then I changed it to socketURL.
This part was easier and does the actual job of verifying the job.
The biggest question I have is with is checking that socket. I know the first code block I provided is wrong, but I'm still trying to figure out how to get it to automatically check the socket's connection. I was looking at the https://socket.io/docs/v2/ to get some sort of picture of how I could get it.
Let me know what you think!
33c17dd41a
to88cce2258e
There are a few issues with the code as it is now.
The code creates a new SocketIO connection, where it should be responding to the reconnection of the already-existing SocketIO connection.
There's two ways to go about this:
stores/socket-status.js
) which is used bycomponents/ConnectionStatus.vue
(i.e.const sockStatus = useSocketStatus();
). Once you have thesockStatus
object, itsisConnected
needs to be monitored / watched via Vue's reactivity system.UpdateListener
component emit asioReconnected
event to bubble that event up to the Vue App, and write an event handler that deals with this.88cce2258e
tocd1011066f
I think I worked out the commit issue. It wouldn't do much for the merge, so I did a reset, and then updated it to Flamenco's most recent branch. It seemed to do the trick for now, but I wanted to focus on the actual code. I also redid the writing of the socket connection, since it was making a new one. I did what you said and used the
useSocketStatus()
from thesocket-status.js
file. The way it was implemented (this.watch
) was based off of something I read on google, so I'm not 100% confident in its ability, but my goal is to make it reactive and execute thesocketIOReconnect()
when the connection has been reestablished. So, I'm hoping that is what is accomplished.I didn't do any changes to the
socketIOReconnect()
, so it's the same functionality as before. Do you think I should rename it to a better name? I'm not very happy with the current name "socketIOReconnect"... I think the name I chose could be a bit more clearer...Thank you for being patient as well, I was really messed up from git, so I will try to do better to be more careful when using it as well.
👍 for being sceptical about the code you find online :)
It's easy enough to test that things work -- just stop & restart Flamenco Manager, and the web interface should indicate a disconnect & a subsequent reconnect.
Before worrying about naming, focus on getting the functionality working. Once it works, and you have a better understanding of how things click together, you'll also have a better idea for the names.
@ -50,0 +55,4 @@
const sockStatus = useSocketStatus();
this.$watch(() => sockStatus.isConnected, (isConnected) => {
if (isConnected) {
This should also check
sockStatus.wasEverDisconnected
, otherwise it'll also respond to the initial connection.@ -59,1 +72,4 @@
},
socketIOReconnect() {
this.fetchManagerInfo()
This function shouldn't be called here, as it does too much. It not only fetches the current version, but also writes to
this.flamencoVersion
. This means that it overwrites the value that you want to compare against.Comparing with
DEFAULT_FLAMENCO_VERSION
is always going to result in a difference, as the Manager will never return the string 'unknown'.@ -60,0 +74,4 @@
socketIOReconnect() {
this.fetchManagerInfo()
if (this.flamencoVersion !== DEFAULT_FLAMENCO_VERSION || this.flamencoName !== DEFAULT_FLAMENCO_NAME ) {
console.log(`Upgraded Flamenco Version: ${this.flamencoVersion}`);
For debugging, it's better to log both versions here: the one that was stored on the webapp startup, and the one that was found now. That way you can see "upgraded from X to Y" in the JS console.
It works!