EdgeStream
Choosing a Transport
The right transport depends on your client environment, backend technology, and whether you need bidirectional messaging. Use this decision matrix to select.
Decision Matrix
| Scenario | Recommended Transport | Reason |
|---|---|---|
| Browser app on ASP.NET Core backend | signalr | Native integration, automatic protocol fallback, managed auth |
| Browser app on non-Microsoft backend | websocket | Protocol-agnostic, bidirectional, low overhead |
| Mobile app (React Native, Capacitor) | websocket | No SignalR dependency needed, binary support |
| Server-to-server integration | websocket | No browser APIs needed, efficient binary framing |
| Read-only event feed (no replies) | sse | Lowest overhead, HTTP/1.1 compatible, firewall-friendly |
| Corporate firewall blocks WebSocket | signalr or http-polling | SignalR negotiates; polling works everywhere over HTTP |
| Strict legacy proxy (no persistent connections) | http-polling | Standard HTTP GET/POST only |
Feature Comparison
| Feature | SignalR | WebSocket | SSE | HTTP Polling |
|---|---|---|---|---|
| Bidirectional | Yes | Yes | No (receive only) | Yes (GET + POST) |
| Binary frames | Yes | Yes (ArrayBuffer) | No (text only) | No |
| Auto reconnect | Yes (built-in) | Yes (manual impl) | Yes (manual impl) | Yes (polling loop) |
| Protocol fallback | Yes (WS → SSE → polling) | No | No | N/A |
| Firewall friendly | Yes (falls back to HTTP) | Depends | Yes (HTTP) | Yes (HTTP) |
| Auth via headers | Yes (accessTokenFactory) | No (query params only) | No (query params) | Yes (headers) |
| ASP.NET Core required | No (but designed for it) | No | No | No |
| Latency | Low | Very low | Low | High (polling interval) |
BizFirstGO Standard Setup
// Standard BizFirstGO app — two servers, optimal transports for each
const stream = createEdgeStream({ logLevel: 'info' });
// BAS server: workflow events, forms, HIL — SignalR for reliable ASP.NET integration
stream.registerServer({
id: 'bas',
type: 'bas',
url: '/hubs/edge-stream',
transportConfig: {
type: 'signalr',
url: '/hubs/edge-stream',
accessToken: authStore.getToken(),
}
});
// Chat server: Octopus agent streaming — WebSocket for minimal latency
stream.registerServer({
id: 'chat',
type: 'chat',
url: 'wss://chat.bizfirst.com/ws',
transportConfig: {
type: 'websocket',
url: 'wss://chat.bizfirst.com/ws',
queryParams: { token: authStore.getChatToken() },
}
});
Environment Detection
import { detectBestTransport } from 'edge-stream-js';
// Detect what's available in the current environment
const best = detectBestTransport();
console.log('Best transport:', best);
// 'websocket' — modern browser or Node.js
// 'sse' — browser without WebSocket (rare)
// 'http-polling' — fully restricted environment
// Note: detectBestTransport() does NOT consider SignalR
// because SignalR requires @microsoft/signalr and a compatible hub.
// Use SignalR explicitly when you know the backend supports it.
When in Doubt, Use SignalR
For BizFirstGO deployments, SignalR is always safe. If the environment supports WebSocket, SignalR uses it. If not, it automatically falls back. You never need to handle fallback logic yourself.