websocket-proxy

command module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2021 License: MIT Imports: 6 Imported by: 0

README

Websocket Proxy

Docker Image Version Docker Image Size Docker Pulls

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:

{
  "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:

{
  "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:

{
  "id": "4cab7bec-dfc2-48a9-a8c9-406118b4242f"
}
Diagram

Sequence diagram

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
ws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL