Help with a web-server

Hi I am trying to build a simple web-server.
My wifi is working cause I can use the companion and download files etc.
My phone (android) says my ip is 192.168.178.28

I use this code:
image

And I use this in my web-browsers URL:
https://192.168.178.28/test=1

But I get nothing as response. Even worse:
Unable to connect

An error occurred during a connection to 192.168.178.28.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the web.

I tried HTTP instead of https to no avail.
I build the program and installed it on my pohone as I thought the companion might be intervening with no result.
And tried several intervals like 50,500.
All no result

Anybody, please

How do you have the (http?) web server setup on your phone ?

Your localhost address would normally be 127.0.0.1

running on what?

The above code is the total setup.
I am sending the https://192.168.178.28/test=1 from my pc

Thanks for responding
Luc

Hi ABG.
The Blocks is the code. I am just trying to receive something.
The blocks running on the Android Phone, the HTTP request send from my PC. I just want to know what I am receiving but I get no connection.

Sorry maybe I am not totally clear.

I want to send some data from my microcontroller to my phone.
The HTTP request should be coming from my microcontroller but for now I am testing on my PC that sends this code.

On the phone I want to see what is received. Nothing more, at this stage.
So the phone should be triggered when the request is received and displayed the received code in the label.

I started here:

But I do not want to send anything to the micrcontroller. I only want to receive some data from the microcontroller.

Luc

Sounds like your microcontroller is providing the data. You will need to "fetch" the data from the microcontroller using the web component in your app. (or it may come in via bluetooth ?)

Hi TIMA12,
I am not using a microcontroller yet. I am just sending the HTTP code from my browser.
Tried on several phones with different IP numbers to no avail.
Set the timeout to 0.

Fetching data is never a problem. I did many projects with that. A button on the screen. Press the button and presto the data is fetched.

What I want is that the phone is always standing by. The App just waiting till it gets a message. If possible even in the background.

Luc

As I intimated, your app has no way of receiving an http request. It will need to be fetching the data. Set a clock timer to routinely poll the url of the microcontroller.

Also, note that the newline character is "\n," and not "/n."

Yes: My bad. Should be \n.

Ok tell me how does pushbullet, ifttt, and all these other services work.
They send info to my phone and the phone is not pulling but gets info and reacts on that by giving a notification. That is what I would like to achieve. Or is the phone constantly pulling all these services.

I'd like a general notification system. That I can send data to from any device I want. Just like a website. The website gets a request from any random computer/phone/tablet/microcontroller and just sends the data there. I even do not want to send data back.
So the only thing my project needs is to register if something is sending data to it. and what the data is.
Perhaps not possible with app-inventor.

@TIMAI2

As I intimated, your app has no way of receiving an http request.

So simply said how do I build an app that has a way to receive http requests.

Luc

Ha !!!
I found the simple webserver by Juan Antonio.
That gives an idea on what I want.
https://groups.google.com/g/mitappinventortest/c/-tn-UY7YJGs/m/tpivqjkVCgAJ?pli=1

Only problem with this is that I can not see what IP requested the webpage
and I would like to send a text to that website.
But that would generally be what I was looking for.

This works with the companion but not as a stand alone program as Wifi permission is not granted.......

Luc