Real internet
Let a WiFi board reach real web services, webhooks and public MQTT brokers. Free once you sign in, with more on Pro, and off until you turn it on.
Turning it on
It works on every board with simulated WiFi, the ESP32 and ESP8266 boards, the Pico W and the Uno R4 WiFi among them (see WiFi, simulated).
Open the Cloud panel and tick Real internet. Mokxi checks your account first:
- Signed out, the switch says to sign in free, and your board keeps the simulated network.
- On Free, signed in with your email address confirmed, it turns on with Free's allowance (below).
- On Pro, the student price, Teacher, Classroom, Pro for work and the free Pro trial, it turns on with the bigger allowance.
Every session starts with it off, so a project never reaches the internet just
by being opened. The one exception is a board on the access point
Wokwi-GUEST, which is what a project imported from Wokwi uses: as on Wokwi,
that access point reaches the internet, so the switch turns itself on when the
project runs. Untick it and it stays off until you reload.
While it is on:
- a request for a name outside
.mokxigoes out through Mokxi's gateway, and the answer comes back to your sketch,https://included (the gateway does the TLS, so usehttp.begin("https://...")); time.mokxi,weather.mokxi,echo.mokxi,api.mokxiand the board's own address stay simulated;- every request still shows in the Cloud panel's log, with a note saying it went through the gateway.
#include <WiFi.h>
#include <HTTPClient.h>
HTTPClient http;
http.begin("https://api.open-meteo.com/v1/forecast?latitude=52.5&longitude=13.4¤t=temperature_2m");
int code = http.GET();
Serial.println(code);
Serial.println(http.getString());
http.end();
A webhook is a POST the same way: http.addHeader("Content-Type", "application/json") and http.POST("{\"temp\":21.5}").
MQTT
A sketch publishes one MQTT message with one HTTP POST to mqtt.mokxi:
http.begin("http://mqtt.mokxi/publish?broker=test.mosquitto.org&topic=mokxi/demo/temp");
http.addHeader("Content-Type", "text/plain");
int code = http.POST("21.5"); // 200 when the broker took it
The gateway sends it to the broker as MQTT over WebSockets. The brokers are the
public test brokers test.mosquitto.org (the default), broker.hivemq.com and
broker.emqx.io. Watch the topic from any MQTT client to see it arrive.
What it does not do, honestly: PubSubClient and other libraries that open a
raw TCP connection to port 1883 do not work, because the simulated board has
no TCP socket and our gateway cannot open one either. Publishing is one way:
the gateway does not subscribe or bring messages back to the board. Topics with
+ or # are refused.
Time
configTime() works and getLocalTime() answers, but the clock is the
simulation's own, which starts at 2026-01-01 00:00:00 UTC: NTP is a UDP
protocol, and real internet carries HTTP. For the real time of day, ask a time
API over HTTP with the switch on.
The limits
| Free | Pro | |
|---|---|---|
| Requests a day, per account | 100 | 1,000 |
| Requests a day, per project | 50 | 500 |
| Requests a minute, per account | 10 | 30 |
| Requests a minute, per project | 10 | 20 |
| Request body | 1,024 bytes | 2,048 bytes |
| Response kept | 2,048 bytes | 4,096 bytes |
| MQTT message | 512 bytes | 1,024 bytes |
Days are UTC. On Free, one network also shares 300 requests a day and 20 a minute across every account signed in on it.
- Past a limit the board gets status 429 with a sentence saying which limit
it hit. Put a
delay()in your loop: a reading every ten seconds for a quarter of an hour is ninety requests. - Sizes: a longer response is cut, and the log says so. A body that is not text (an image, say) is left out.
- Time: the host gets 4 seconds to answer.
- Methods: GET and POST, on ports 80, 443, 8080 and 8443.
- Redirects are not followed. A 301 or 302 comes back to your sketch as it is, with the address it points at as the body.
- What is refused: private and local addresses (10.x, 192.168.x,
127.0.0.1, 169.254.x and the IPv6 equivalents), names like
localhostor anything under.localor.internal, a name that resolves to one of those, Cloudflare's and Mokxi's own hosts, and any host we have had to stop. Your sketch gets a refusal with the reason in the Cloud panel.WiFiClientSecureis still refused; use a plainWiFiClientor none.
What we keep
Counts, and nothing else: how many requests each account, project and network sent today, so the daily limits work, and how many the whole service sent. A network is counted under a scrambled code that changes every day, never its address. No address, URL, header or body is stored or logged.
In a class
For a student in a class, real internet is off unless the teacher turns it on, whatever plan the student is on. A teacher whose class tools are on (Pro, Teacher, Classroom or the trial) can switch it on for a class, and the class then has Pro's limits; until then the student's switch says it is off for their class. Accounts marked as under 13 follow the same rule.