Click the button below to flash your ESP8266 with the pocket server firmware (supported on Chrome-based browsers only).
After flashing and rebooting your ESP8266, connect to the Wi-Fi network prefixed with "pocket-server" using default password "password123". On some devices, the admin page will automatically appear. If not, you can navigate to http://192.168.4.1.
Once on the admin page, upload any .html file.
Downloadable examples below. Any future devices connecting to your
pocket server will see this page by default.
To get back to the admin page, navigate to http://192.168.4.1/admin.
The API allows you to interact with the pocket server to manage files, control GPIO pins, and communicate via WebSockets.
List Files: retrieve a list of all files stored on the device's filesystem.
/filesGETcurl http://192.168.4.1/files[
{
"name": "index.html",
"size": 1024
},
{
"name": "style.css",
"size": 500
}
]
Upload File: uploads a file to the device. The file will be saved with its original filename.
/filesPOSTmultipart/form-dataupload: The file to upload.curl -X POST -F "upload=@example.html" http://192.168.4.1/files200 OK upon success.Set Home Page: uploads a file and saves it as index.html, effectively setting it as the homepage of the device.
/sethomePOSTmultipart/form-dataupload: The file to upload (will be renamed to index.html).curl -X POST -F "upload=@index.html" http://192.168.4.1/sethome200 OK upon success.Delete File: deletes a specific file from the filesystem.
/files/{filename}DELETEcurl -X DELETE http://192.168.4.1/files/example.html200 OK: File deleted successfully.404 Not Found: File does not exist.500 Internal Server Error: Deletion failed.Clear Storage: deletes all files from the filesystem (excluding system files if any are protected, though currently it wipes everything visible).
/storageDELETEcurl -X DELETE http://192.168.4.1/storage200 OK: All files deleted.Read Pin State: reads the current digital state of a GPIO pin.
/pin/{pin_number}GETpin_number: The GPIO pin number (e.g., 0, 2, 4, 5, 12, 13, 14, 15, 16).curl http://192.168.4.1/pin/5{
"pin": 5,
"value": 1 // 1 for HIGH, 0 for LOW
}
400 Bad Request: Invalid or unsafe pin number.Control Pin: sets the mode and/or digital value of a GPIO pin.
/pin/{pin_number}POSTapplication/json{
"mode": "OUTPUT", // "INPUT", "OUTPUT", or "INPUT_PULLUP"
"value": 1 // 0 (LOW) or 1 (HIGH)
}
curl -X POST -H "Content-Type: application/json" -d '{"mode":"OUTPUT","value":1}' http://192.168.4.1/pin/5{
"pin": 5,
"value": 1
}
400 Bad Request: Invalid pin, invalid JSON, or no body received.WebSocket Connection: connect to the WebSocket for real-time interaction. Messages sent to this endpoint are broadcast to all other connected clients.
/websocketws://Admin Page: access the built-in file management interface.
/adminGET