Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to stop the server or otherwise make it not crash on a page reload? #4

Open
BodoMinea opened this issue Mar 10, 2021 · 1 comment

Comments

@BodoMinea
Copy link

Hi,

At some points in my app's execution, the page may be refreshed, causing the code to be re-run. This causes the plugin to loose connection with the underlying Java server and thus the cordova side of the server is not working anymore.

One solution would be to stop the server before refresh, so that when the pages reinitializes everything is „fresh”.

I see there was an attempt to make a „stop” function but it is not finished and commented out: https://github.com/jh3141/cordova-plugin-httpserver-dynamic/blob/master/plugin/www/dynamicHttpServer.js#L34

My knowledge of Java is limited and the project seems abandoned so I am addressing the potential community - does anyone know how to make the stop function work?

Thanks.

@BodoMinea
Copy link
Author

BodoMinea commented Jan 5, 2022

I implemented the server stop function in my own fork - https://github.com/BodoMinea/cordova-plugin-httpserver-dynamic
The command is cordova.plugins.dynamicHttpServer.stopServer(serverId, successCallback, errorCallback);
Install with cordova plugin add 'https://gitpkg.now.sh/BodoMinea/cordova-plugin-httpserver-dynamic/plugin?master' or clone and install locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant