https://github.com/touchdeck/websocket-proxy
A websocket proxy with local discovery for piping data between two clients.
https://github.com/touchdeck/websocket-proxy
docker-image proxy server websocket websocket-proxy
Last synced: 9 days ago
JSON representation
A websocket proxy with local discovery for piping data between two clients.
- Host: GitHub
- URL: https://github.com/touchdeck/websocket-proxy
- Owner: TouchDeck
- License: mit
- Created: 2020-12-18T22:10:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-07T15:14:26.000Z (over 4 years ago)
- Last Synced: 2025-01-14T04:08:36.848Z (6 months ago)
- Topics: docker-image, proxy, server, websocket, websocket-proxy
- Language: Go
- Homepage: https://hub.docker.com/r/lucascorpion/websocket-proxy
- Size: 95.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Websocket Proxy
[](https://hub.docker.com/r/lucascorpion/websocket-proxy)
[](https://hub.docker.com/r/lucascorpion/websocket-proxy)
[](https://hub.docker.com/r/lucascorpion/websocket-proxy)A websocket proxy with local discovery for piping data between two clients.
The proxy differentiates between two kinds of clients: agents and remotes. Agents are clients that listen for messages, and optionally reply to them. Remotes are clients that want to connect to an agent.
## API
### `/agents`
A discovery endpoint which lists all agents in the local network (based on the request's public IP address).
### `/ws/agent` and `/ws/remote`
The websocket endpoints for the agent and remote clients, respectively.
## Websocket Protocol
### Agent
After connecting, the agent should send a message with a JSON object. This object can contain a `meta` field with freeform metadata about the agent. For example:
```json
{
"meta": {
"version": "1.0.0",
"platform": "linux"
}
}
```The proxy will then assign a unique id to this agent, which remotes can use to identify it. It will send the full agent object back to the agent:
```json
{
"id": "4cab7bec-dfc2-48a9-a8c9-406118b4242f",
"meta": {
"version": "1.0.0",
"platform": "linux"
}
}
```### Remote
After connecting, the agent should send a message with a JSON object. This object should contain an `id` field with the id of the agent to connect to. For example:
```json
{
"id": "4cab7bec-dfc2-48a9-a8c9-406118b4242f"
}
```### Diagram
