Transport TCP WebSocket HTTP2
When to use this
You need to pick the right protocol for edge clients (browser), backend services, or high-throughput internal calls.
Prerequisites
Protocol overview
| Transport | GG setup | GraftConfig.host example | Typical use |
|---|---|---|---|
| WebSocket | Default (--port) | ws://host:8888/ws | Browser edge clients, MCP |
| TCP | --tcpServer --tcpPort 8990 | tcp://host:8990 | Service-to-service, low overhead |
| HTTP/2 | --http2Server --http2Port 8989 | Per deployment config | Advanced / HTTP/2-enabled infra |
| In-memory | Same process | (unset) | Dev, modular monolith |
WebSocket server is always enabled. TCP and HTTP/2 are opt-in flags.

WebSocket (edge clients)
Gateway:
./gg ./MyLib.dll --port 8888 --httpPort 8889
Consumer:
GraftConfig.host = "ws://localhost:8888/ws";
Use WSS (wss://) behind TLS — Transport security TLS/WSS.
TCP (backend services)
Gateway:
./gg ./MyLib.dll --port 8888 --tcpServer --tcpPort 8990
Consumer:
GraftConfig.host = "tcp://order-service:8990";
GraftConfig.host = "tcp://order-service:8990";
HTTP/2
Gateway:
./gg ./MyLib.dll --http2Server --http2Port 8989 --port 8888
Enable when your infrastructure standardizes on HTTP/2. WebSocket and TCP remain the most common Graft paths today.
Verify it works
- Telnet/curl to the chosen port
- Successful Graft method call with
GG_DEBUG=1showing traffic on expected port
Common mistakes
| Mistake | Fix |
|---|---|
tcp:// but --tcpServer not set | Enable --tcpServer on GG |
Browser using tcp:// | Use ws:// for browser clients |
| Port mismatch | Align GraftConfig.host port with GG flags |