An Android app that runs an HTTP/WebSocket server for service sharing in local networks.
- HTTP server with WebSocket support using Netty
- Optional HTTPS with self-signed certificate
- Service registration via WebSocket
- HTTP request relay to connected services
- Foreground service for background operation
- Service management UI (view, kick)
- Connect via WebSocket and register endpoints
- Define HTTP routes that relay to the service
- Provide static resources (HTML/JS/CSS)
- No server-side storage - everything relayed
┌─────────────┐ WebSocket ┌─────────────────┐
│ Service │◄───────────────────►│ WSTun App │
│ Client │ │ (HTTP Server) │
└─────────────┘ └────────┬────────┘
│ HTTP
▼
┌─────────────────┐
│ Web Browser │
│ (User) │
└─────────────────┘
- Service connects via WebSocket and registers
- User accesses
http://server/[service]/main - Server relays request to service via WebSocket
- Service sends response via WebSocket
- Server sends HTTP response to user
cd wstun
./gradlew assembleDebugcd services/fileshare
npm install
cd services/chat
npm install- Install the APK on an Android device
- Configure port and HTTPS option
- Tap "Start Server"
- Note the displayed IP address
# File sharing
cd services/fileshare
node client.js ws://192.168.1.100:8080/ws
# Chat
cd services/chat
node client.js ws://192.168.1.100:8080/ws- Server info:
http://192.168.1.100:8080/ - FileShare:
http://192.168.1.100:8080/fileshare/main - Chat:
http://192.168.1.100:8080/chat/main
{
"type": "register",
"id": "unique-id",
"payload": {
"name": "servicename",
"type": "service-type",
"description": "Service description",
"endpoints": [
{ "path": "/main", "method": "GET", "relay": true }
],
"static_resources": {
"/main": "<html>...</html>"
}
}
}Server sends to service:
{
"type": "http_request",
"payload": {
"request_id": "req-123",
"method": "GET",
"path": "/servicename/main",
"headers": { "Content-Type": "text/html" },
"body": "..."
}
}Service responds:
{
"type": "http_response",
"payload": {
"request_id": "req-123",
"status": 200,
"headers": { "Content-Type": "text/html" },
"body": "<html>...</html>"
}
}Share files without server storage:
- Virtual folder tree
- File upload/download via browser
- Relay mode for temporary sharing
- All data flows through the client
Real-time chat with rich messages:
- Text, Card, and Poll message types
- Broadcast to all or private messages
- Abstract JSON format for custom rendering
- Self-contained HTML/JS/CSS
- HTTPS uses self-signed certificate (browser warning expected)
- No authentication built-in (add as needed)
- For local network use only
- Services should validate inputs
MIT