-
Notifications
You must be signed in to change notification settings - Fork 5
WebSocket
im-pingo edited this page Mar 26, 2026
·
1 revision
English | 中文
LiveForge supports live streaming over WebSocket, delivering FLV, TS, or FMP4 data as binary WebSocket frames. This enables browser-based players using the Media Source Extensions (MSE) API.
ws://host:8080/ws/{app}/{key}.{format}
Supported formats: flv, ts, mp4
ws://localhost:8080/ws/live/stream1.flv
ws://localhost:8080/ws/live/stream1.ts
ws://localhost:8080/ws/live/stream1.mp4
WebSocket streaming shares the same HTTP listener as HTTP Streaming. No additional configuration or ports are needed -- the /ws/ path prefix routes requests to the WebSocket handler automatically.
- The client upgrades an HTTP connection to WebSocket
- The server sends init data (FLV header or FMP4 init segment) as the first binary message
- Subsequent muxed media data is pushed as binary WebSocket frames
- The connection closes when the client disconnects or the stream ends
| Format | Extension | Content | Typical Browser Player |
|---|---|---|---|
| FLV | .flv |
FLV tags (video + audio) | flv.js, mpegts.js |
| TS | .ts |
MPEG-TS packets | mpegts.js, hls.js |
| FMP4 | .mp4 |
fMP4 init + moof/mdat fragments | Native MSE |
- Browser-based low-latency playback -- WebSocket-FLV with flv.js or mpegts.js provides sub-second latency in browsers
- Custom web players -- build real-time dashboards or monitoring UIs with MSE
- Bypassing HTTP chunked-transfer limitations -- some CDNs or proxies buffer chunked HTTP responses; WebSocket avoids this