Server Stopped Callback

In my custom module Im using app.on(close) to delete a config file that only gets made when the server is started. Is there a callback for when the server is stopped since that deletes the file if a client disconnects?

I'm using fragments and editing them, but closing the fragment window as a client removes the config file. I can create it again by opening another new window but I'd like to be able to just delete that file when the server is closed.

Hi @Tyler_Leonard ,

Through my own testing, I'm not sure if this is the exact order according to Jean's OSC protocol, (feel correct me if I'm wrong Jean). But here is the order I've noted:

// OSC exec order
// init -> created -> open -> sessionOpened -> sessionClosed -> close -> destroyed -> unload

I believe either destroyed or unload would work. I'm thinking more destroyed though just spitballing without testing it.

Cheers!

1 Like

Strange, I've been referencing the callbacks here:

I tested all of those but the only one that works the way I'd want is close, however, it happens per client instance instead of server stop. I have app.on("sessionOpened") creating this file, which it may be overwriting per instance as well but that's alright for the creation, the deleting I want to happen just before the server is stopped when everything is closing.

1 Like

unload is tied to the custom module's lifecycle (not the server's) and destroyed is merely a followup of close. There's no server shutdown callback but it's a good idea I'll add it !

2 Likes

That's the same file I initally found the cycle calls as well. Through observation and testing is where I noted the sequences of the cycles.

unload is tied to the custom module's lifecycle (not the server's) and destroyed is merely a followup of close. There's no server shutdown callback but it's a good idea I'll add it !

That would be great addition Jean, thanks!

Cheers!

Thankyou so much!!