When to use gRPC vs HTTP
| Factor | gRPC | HTTP |
|---|---|---|
| Latency | Lower per-call overhead (binary protocol, persistent connections) | Slightly higher due to JSON serialization |
| Streaming | Native bidirectional streaming (Subscribe, StreamSearch, WatchMemory) | SSE for events, no bidirectional streaming |
| Debugging | Requires gRPC tooling (grpcurl, Bloom RPC) | curl, browser dev tools |
| Proxies/CDNs | Requires HTTP/2-aware infrastructure | Works everywhere |
| Browser clients | Requires grpc-web proxy | Native fetch/XMLHttpRequest |
Configuration
Environment variables
.env
SDK constructor
- Python
- Node / TS
- Rust
Endpoints
| Environment | gRPC endpoint | TLS |
|---|---|---|
| Hosted (production) | grpc.api.mubit.ai:443 | Yes (system CA) |
| Hosted (dev) | grpc.api.dev.mubit.ai:443 | Yes (system CA) |
| Local | 127.0.0.1:50051 | No (plaintext) |
Proto file locations
The proto definitions are available in the repository:| Proto file | Service | Description |
|---|---|---|
proto/mubit/v1/core.proto | MubitService | Core data-plane operations (insert, search, memory, sessions) |
proto/mubit/v1/control.proto | ControlService | Control-plane operations (ingest, query, context, reflection, coordination) |
Streaming RPCs
gRPC enables streaming RPCs not available over HTTP:| RPC | Direction | Purpose |
|---|---|---|
Subscribe (Control) | Server → Client | Stream control-plane events in real-time |
StreamSearch (Core) | Server → Client | Stream search results as they’re found |
WatchMemory (Core) | Server → Client | Watch for scratchpad memory changes |
- Python
- Node / TS
- Rust
Auto transport
Whentransport is set to "auto" (the default), the SDK:
- Checks if a gRPC connection can be established to the endpoint
- Falls back to HTTP if gRPC is unavailable
- Caches the result for subsequent calls
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Connection refused on port 50051 | gRPC server not running or wrong endpoint | Verify endpoint; for local, ensure make run-mubit is running |
| TLS handshake failure | Self-signed cert or wrong CA | For hosted endpoints, ensure system CA store is current |
UNIMPLEMENTED error | Proto version mismatch | Update SDK to latest version |
DEADLINE_EXCEEDED | Network timeout | Check connectivity; increase timeout in client config |
| Fields missing in response | keepCase not set (JS SDK < v0.4.1) | Update @mubit-ai/sdk to >= v0.4.1 |
Next steps
- See SDK Configuration Reference for all config options.
- See Control gRPC reference for the full RPC surface.