Gorilla Websocket is a popular open-source library for handling WebSocket connections in Go. It provides an efficient and flexible way to build real-time, bidirectional communication applications. Helix, a data streaming platform built on Tremor, can leverage Gorilla Websocket to create various use cases, such as websocket servers, proxies, and bridges.
Tremor Documentation
Tremor is a streaming data processing framework that can be used to build various data pipelines. Helix is built on top of Tremor. The following documentation snippets from Tremor illustrate how to use Gorilla Websocket for websocket servers, proxies, and bridges.
Websocket Server
A Tremor websocket server listens for incoming connections and sends messages back to clients using the WebSocket protocol.
# Example Websocket server application
# Configure a websocket onramp listening on port 8139
onramp :
- id : ws
type : ws
linked : true
codec : string
preprocessors :
- lines
config :
host : 0.0.0.0
port : 8139
# Message flow
# Incoming websocket messages from a client's websocket connection are sent to the pipeline echo and the output of it is sent back again from the same connection.
binding :
- id :
Websocket Proxy
A Tremor websocket proxy acts as an intermediary between two websocket connections. It forwards messages between the upstream and downstream connections.
# Example Websocket proxy application
# Configure a websocket onramp listening on port 9139, that is meant to be a proxy for our example websocket server
onramp :
- id : ws
type : ws
linked : true
codec : string
preprocessors :
- lines
config :
host : 0.0.0.0
port : 9139
# Configure a websocket offramp as an endpoint in the websocket onramp
offramp :
- id : upstream
type : ws
linked : true
codec : string
WebSocket Concepts and Use Cases
WebSocket is a protocol providing full-duplex communication channels over a single TCP connection. It is widely used for real-time applications, such as live chat, online gaming, and IoT data streaming.
Red Hat Developer: Unleashing Power of WebSockets on RHEL 6
Bohuslav Kabrda: Unleashing Power of WebSockets on RHEL 6
This article explains the basics of WebSocket technology and its use cases, such as live web chat.
NATS Blog: Getting started with nats.ws
NATS Blog: Getting started with nats.ws
This blog post provides an introduction to NATS WebSocket server and client, and demonstrates how to use them for sending and receiving messages.
Tremor HTTP -> Websocket Bridge
Tremor HTTP -> Websocket Bridge
A Tremor HTTP -> Websocket bridge forwards incoming HTTP requests to a websocket server and returns the websocket response as an HTTP response.
# Example HTTP -> Websocket bridge application
# Configure a REST onramp listening on port 9139
onramp :
- id : http
type : rest
linked : true
codec : string
config :
host : 0.0.0.0
port : 9139
# Configure a websocket offramp
offramp :
- id : ws
type : ws
linked : true
codec : string
OBS and WebSockets for Streaming Video
How I stream video with OBS and WebSockets
This article explains how to use Open Broadcaster Software (OBS) and WebSockets for streaming video.
Tremor ws Connector
The Tremor ws connector provides support for the WebSocket protocol specification. It can be used to create a websocket server or client.
# Example Tremor ws connector configuration
# ws_server connector
connector :
- id : ws_server
type : ws_server
# ws_client connector
connector :
- id : ws_client
type : ws_client
Grafana Live with WebSockets
Grafana Live is a feature that allows you to visualize real-time data in Grafana. It uses WebSockets for data streaming.
# Configure Grafana Live with WebSockets
# Set up Grafana Live
# ...
# Create a WebSocket data source
# ...
# Configure a WebSocket panel
# ...
Project Contour: WebSockets
Project Contour is an open-source API gateway. It supports WebSockets for handling real-time data.
# Example Project Contour WebSockets configuration
apiVersion : projectcontour.io/v1
kind : HTTPProxy
metadata :
name : chat
namespace : default
spec :
virtualhost :
fqdn : chat.example.com
routes :
- services :
- name : chat-app
port : 80
conditions :
- prefix : /websocket
enableWebsockets : true
services :
- name : chat-app
port : 80