Webservice in a webapp cannot be connected

I created a web app and a desktop app
the desktop app should send data to the web app
Running both on my mac in debug, I cannot make desktop app connect to web app. I don’t know if there is something I need to do to make it accessible.
I tried the desktop app accessing the external server (https://webhook.site/ ) and it works, so I believe it is not a problem with my desktop app. When I change to my local web app I receive error -1004 (not possible to connect)
But when I run the web app locally, I can open the web service link that I am using the handleurl to open in my browser. But not always.
Could anyone share some light?

A Web app is used to display a home page to a user that connects to the Web app from a browser (http:// or https://). A web app is a Web server that responds to the user through the interface.

So you want to create a Web service, that’s different than a Web app. A Web service does not have an interface, it responds to other another piece of software sending commands to a specific port, and reply with json for example.

The Web app you create must be running for the Web service to work.

I understood, after reviewing many ideas that I could use a webapp as a webservice. It should only receive some information and add it to a database. It seems overkill to create a third app just to do that.

That depends on the level of security you wish to implement. For example, the user/password for the database is never sent to your web service, and only the server running the web service can connect to the db server. The data exchange between the service and the user app can be encrypted, adding to the security.

Do you read this about web services ?

You cannot run both the desktop and web app in the IDE. You should compile the desktop app, and then run the web app in the IDE.

The web app must be running for the handleurl event to happen.

This fires handleURL when the app launches, and then when a folder is used, for instance
http://127.0.0.1:8080/whatever

If you upload that app to a host, this will work just the same on most hosts, except on Xojo Cloud where /index/must be added. For instance http://174.33.34.35/Myapp/index/whatever

1 Like

I would like to thank you all
I believe I was too tired yesterday. The error is that I was using https while locally I should be using HTTP.

1 Like