You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Easegress is popular for reverse proxy usage in production and development scenarios.
In reversed proxy use cases, WebSocket is a widely used protocol for a full-duplex communication solution between client and server. It relies on TCP.[1]
Many reverse proxy support WebSocket,e.g., NGINX[2], Traefik, and so on.
Proposal
Bring WebSocketServer as an BusinessController to Easegress. (Should treat it as an HTTPServer like traffic gate in the future. )
Using github.com/gorilla/websocket as the WebSocket client implementation, since it has rich features supproted and a quite active community.(15k star/2.5k fork) Comparing to the original golang.org/x/net/websocket package, it can receive fragmented message and send close message.[3]
Design
Spec
kind: WebSocketServername: websocketSvrhttps: false # client need to use http/https firstly for connection upgrade certBase64:
keyBase64:
port: 10020# proxy servers listening portbackend: ws:https://localhost:3001 # the reserved proxy target# Easegress will exame the backend URL's scheme, If it starts with `wss`,# then `wssCerBase64` and `wssKeyBase64` must not be emptywssCertBase64: # wss backend certificate in base64 formatwssKeyBase64: # wss backend key in base64 format
The WebSocketServer shares some configurations with HTTPServer. Since WebSocket runs on HTTP 1.1 only, and it works on opening two long-life goroutines for the reverse proxy scenario, it's quite different from the original Easegress' HTTPServer+Pipeline's process. So I decide not to implement it into HTTPServer and catalog it into TrafficGate in the first version right now.
I will implement this WebSocketServer first version and try to figure out how to integrate with the original HTTPServer at the same time. (Moreover, multiple protocols supporting requirements, such as MQTT, TPC, are on the way... )
Background
WebSocket
is a widely used protocol for a full-duplex communication solution between client and server. It relies on TCP.[1]WebSocket
,e.g., NGINX[2], Traefik, and so on.Proposal
WebSocketServer
as an BusinessController to Easegress. (Should treat it as anHTTPServer
like traffic gate in the future. )github.com/gorilla/websocket
as theWebSocket
client implementation, since it has rich features supproted and a quite active community.(15k star/2.5k fork) Comparing to the originalgolang.org/x/net/websocket
package, it canreceive fragmented message
andsend close message
.[3]Design
The
WebSocketServer
shares some configurations withHTTPServer
. SinceWebSocket
runs onHTTP 1.1
only, and it works on opening two long-life goroutines for the reverse proxy scenario, it's quite different from the original Easegress' HTTPServer+Pipeline's process. So I decide not to implement it intoHTTPServer
and catalog it intoTrafficGate
in the first version right now.I will implement this
WebSocketServer
first version and try to figure out how to integrate with the originalHTTPServer
at the same time. (Moreover, multiple protocols supporting requirements, such asMQTT
,TPC
, are on the way... )References
The text was updated successfully, but these errors were encountered: