gin

package
v1.9.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package gin provides a wrapper around the Gin web framework This package exposes commonly used Gin functionality through a clean interface while maintaining compatibility with the underlying gin.Engine and gin.Context

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionClosed = errors.New("websocket connection is closed")
	ErrInvalidConnType  = errors.New("invalid connection type for websocket implementation")
)

Functions

func CORS added in v1.9.6

func CORS() backends.MiddlewareFunc

CORS returns the default CORS middleware

func CORSWithConfig added in v1.9.6

func CORSWithConfig(config backends.CORSConfig) backends.MiddlewareFunc

CORSWithConfig returns CORS middleware with custom configuration

func CreateEngine added in v1.9.6

func CreateEngine() backends.Engine

CreateEngine creates a new blank Engine without middleware, wrapped as backends.Engine

func CreateEngineWithDefaults added in v1.9.6

func CreateEngineWithDefaults() backends.Engine

CreateEngineWithDefaults creates a new Engine with default middleware, wrapped as backends.Engine

func CreateEventHandler

func CreateEventHandler(relayServer *cluster.RelayServer) backends.RealtimeEventHandler

CreateEventHandler creates a new DefaultEventHandler

func CreateProcessSubscription

func CreateProcessSubscription(wsConn *websocket.Conn, wsMsgType int, processID string, executorType string, timeout int, state int) *backends.RealtimeSubscription

func CreateProcessesSubscription

func CreateProcessesSubscription(wsConn *websocket.Conn, wsMsgType int, executorType string, timeout int, state int) *backends.RealtimeSubscription

func CreateSubscription

func CreateSubscription(wsConn *websocket.Conn, wsMsgType int, processID string, executorType string, state int, timeout int) *backends.RealtimeSubscription

Utility functions for backward compatibility with existing websocket code

func CreateTestableEventHandler

func CreateTestableEventHandler(relayServer *cluster.RelayServer) backends.TestableRealtimeEventHandler

CreateTestableEventHandler creates a new DefaultEventHandler that implements TestableRealtimeEventHandler for testing

func IsDebugging

func IsDebugging() bool

IsDebugging returns true if the framework is running in debug mode

func Mode

func Mode() string

Mode returns the current Gin mode

func NewBackendServer added in v1.9.6

func NewBackendServer(port int, engine backends.Engine) backends.Server

NewBackendServer creates a new Server from a backends.Engine, wrapped as backends.Server

func NewBackendServerWithAddr added in v1.9.6

func NewBackendServerWithAddr(addr string, engine backends.Engine) backends.Server

NewBackendServerWithAddr creates a new Server with address from a backends.Engine

func NewContextAdapter

func NewContextAdapter(ginContext *ginframework.Context) backends.Context

NewContextAdapter creates a new adapter for gin.Context

func NewEngineAdapter

func NewEngineAdapter(ginEngine *Engine) backends.Engine

NewEngineAdapter creates a new adapter for gin.Engine

func NewFactory

func NewFactory() backends.RealtimeBackend

NewFactory creates a new WebSocket factory

func NewServerAdapter

func NewServerAdapter(ginServer *Server) backends.Server

NewServerAdapter creates a new adapter for gin.Server

func NewSubscriptionController

func NewSubscriptionController(eventHandler backends.RealtimeEventHandler) backends.RealtimeSubscriptionController

NewSubscriptionController creates a new WebSocket subscription controller

func NewWebSocketConnection

func NewWebSocketConnection(conn *websocket.Conn) backends.RealtimeConnection

NewWebSocketConnection creates a new WebSocketConnection

func SetMode

func SetMode(value string)

SetMode sets the Gin mode (debug, release, test)

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context wraps gin.Context with additional functionality

func NewContext

func NewContext(ginContext *gin.Context) *Context

NewContext creates a new Context wrapper

func (*Context) Abort

func (c *Context) Abort()

Abort prevents pending handlers from being called

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(code int)

AbortWithStatus calls Abort() and writes the headers with the specified status code

func (*Context) AbortWithStatusJSON

func (c *Context) AbortWithStatusJSON(code int, jsonObj interface{})

AbortWithStatusJSON calls Abort() and then JSON() internally

func (*Context) Bind

func (c *Context) Bind(obj interface{}) error

Bind checks the Content-Type to select a binding engine automatically

func (*Context) BindJSON

func (c *Context) BindJSON(obj interface{}) error

BindJSON is a shortcut for c.Bind(obj) with binding.JSON

func (*Context) Data

func (c *Context) Data(code int, contentType string, data []byte)

Data writes raw data into the response body

func (*Context) DefaultPostForm

func (c *Context) DefaultPostForm(key, defaultValue string) string

DefaultPostForm returns the specified key from a POST urlencoded form or multipart form, otherwise returns the default value

func (*Context) DefaultQuery

func (c *Context) DefaultQuery(key, defaultValue string) string

DefaultQuery returns the keyed url query value if it exists, otherwise returns the default value

func (*Context) Get

func (c *Context) Get(key string) (value interface{}, exists bool)

Get returns the value for the given key, ie: (value, true)

func (*Context) GetBool

func (c *Context) GetBool(key string) (b bool)

GetBool returns the value associated with the key as a boolean

func (*Context) GetFloat64

func (c *Context) GetFloat64(key string) (f64 float64)

GetFloat64 returns the value associated with the key as a float64

func (*Context) GetHeader

func (c *Context) GetHeader(key string) string

GetHeader returns the value of the request header

func (*Context) GetInt

func (c *Context) GetInt(key string) (i int)

GetInt returns the value associated with the key as an integer

func (*Context) GetInt64

func (c *Context) GetInt64(key string) (i64 int64)

GetInt64 returns the value associated with the key as an integer

func (*Context) GetString

func (c *Context) GetString(key string) (s string)

GetString returns the value associated with the key as a string

func (*Context) GinContext

func (c *Context) GinContext() *gin.Context

GinContext returns the underlying gin.Context

func (*Context) Header

func (c *Context) Header(key, value string)

Header sets a response header

func (*Context) IsAborted

func (c *Context) IsAborted() bool

IsAborted returns true if the current context was aborted

func (*Context) JSON

func (c *Context) JSON(code int, obj interface{})

JSON serializes the given struct as JSON into the response body

func (*Context) Next

func (c *Context) Next()

Next should be used only inside middleware

func (*Context) Param

func (c *Context) Param(key string) string

Param returns the value of the URL param

func (*Context) PostForm

func (c *Context) PostForm(key string) string

PostForm returns the specified key from a POST urlencoded form or multipart form

func (*Context) Query

func (c *Context) Query(key string) string

Query returns the keyed url query value if it exists

func (*Context) ReadBody

func (c *Context) ReadBody() ([]byte, error)

ReadBody reads the request body and returns it as bytes

func (*Context) Request

func (c *Context) Request() *http.Request

Request returns the underlying HTTP request

func (*Context) Set

func (c *Context) Set(key string, value interface{})

Set stores a new key/value pair exclusively for this context

func (*Context) ShouldBind

func (c *Context) ShouldBind(obj interface{}) error

ShouldBind checks the Content-Type to select a binding engine automatically

func (*Context) ShouldBindJSON

func (c *Context) ShouldBindJSON(obj interface{}) error

ShouldBindJSON is a shortcut for c.ShouldBind(obj) with binding.JSON

func (*Context) Status

func (c *Context) Status(code int)

Status sets the HTTP response code

func (*Context) String

func (c *Context) String(code int, format string, values ...interface{})

String writes a string response with the given HTTP status code

func (*Context) Writer

func (c *Context) Writer() gin.ResponseWriter

Writer returns the response writer

func (*Context) XML

func (c *Context) XML(code int, obj interface{})

XML serializes the given struct as XML into the response body

type ContextAdapter

type ContextAdapter struct {
	// contains filtered or unexported fields
}

ContextAdapter adapts gin.Context to the generic Context interface

func (*ContextAdapter) Abort

func (g *ContextAdapter) Abort()

func (*ContextAdapter) AbortWithStatus

func (g *ContextAdapter) AbortWithStatus(code int)

func (*ContextAdapter) AbortWithStatusJSON

func (g *ContextAdapter) AbortWithStatusJSON(code int, jsonObj interface{})

func (*ContextAdapter) Bind

func (g *ContextAdapter) Bind(obj interface{}) error

func (*ContextAdapter) BindJSON

func (g *ContextAdapter) BindJSON(obj interface{}) error

func (*ContextAdapter) Data

func (g *ContextAdapter) Data(code int, contentType string, data []byte)

func (*ContextAdapter) DefaultPostForm

func (g *ContextAdapter) DefaultPostForm(key, defaultValue string) string

func (*ContextAdapter) DefaultQuery

func (g *ContextAdapter) DefaultQuery(key, defaultValue string) string

func (*ContextAdapter) Get

func (g *ContextAdapter) Get(key string) (value interface{}, exists bool)

func (*ContextAdapter) GetBool

func (g *ContextAdapter) GetBool(key string) bool

func (*ContextAdapter) GetFloat64

func (g *ContextAdapter) GetFloat64(key string) float64

func (*ContextAdapter) GetHeader

func (g *ContextAdapter) GetHeader(key string) string

func (*ContextAdapter) GetInt

func (g *ContextAdapter) GetInt(key string) int

func (*ContextAdapter) GetInt64

func (g *ContextAdapter) GetInt64(key string) int64

func (*ContextAdapter) GetString

func (g *ContextAdapter) GetString(key string) string

func (*ContextAdapter) GinContext

func (g *ContextAdapter) GinContext() *ginframework.Context

GinContext returns the underlying raw gin.Context - needed for realtime handler

func (*ContextAdapter) Header

func (g *ContextAdapter) Header(key, value string)

func (*ContextAdapter) IsAborted

func (g *ContextAdapter) IsAborted() bool

func (*ContextAdapter) JSON

func (g *ContextAdapter) JSON(code int, obj interface{})

func (*ContextAdapter) Next

func (g *ContextAdapter) Next()

func (*ContextAdapter) Param

func (g *ContextAdapter) Param(key string) string

func (*ContextAdapter) PostForm

func (g *ContextAdapter) PostForm(key string) string

func (*ContextAdapter) Query

func (g *ContextAdapter) Query(key string) string

func (*ContextAdapter) ReadBody

func (g *ContextAdapter) ReadBody() ([]byte, error)

func (*ContextAdapter) Request

func (g *ContextAdapter) Request() *http.Request

func (*ContextAdapter) Set

func (g *ContextAdapter) Set(key string, value interface{})

func (*ContextAdapter) ShouldBind

func (g *ContextAdapter) ShouldBind(obj interface{}) error

func (*ContextAdapter) ShouldBindJSON

func (g *ContextAdapter) ShouldBindJSON(obj interface{}) error

func (*ContextAdapter) Status

func (g *ContextAdapter) Status(code int)

func (*ContextAdapter) String

func (g *ContextAdapter) String(code int, format string, values ...interface{})

func (*ContextAdapter) XML

func (g *ContextAdapter) XML(code int, obj interface{})

type DefaultEventHandler

type DefaultEventHandler struct {
	// contains filtered or unexported fields
}

DefaultEventHandler implements the backends.RealtimeEventHandler interface.

Signal Distribution Strategy (Thundering Herd Prevention):

This event handler uses a two-pass signal distribution to prevent the "thundering herd" problem that can cause massive database load amplification.

The Problem: When a new process is submitted, executors waiting for work need to be notified. If ALL waiting executors wake up simultaneously (broadcast), they all call Assign() at once, creating a stampede of database operations. With 8 executors and buffered channels allowing rapid re-wake, this caused 1,840x amplification in production (19.7M database updates for 1,341 processes instead of ~10K expected).

The Solution - Two-Pass Distribution:

Pass 1 (Broadcast): Notify ALL listeners waiting for a SPECIFIC processID. This is used for state change notifications (e.g., process completed) where the caller needs to know about their specific process.

Pass 2 (Single Wake-up with Round-Robin): Wake exactly ONE general listener. General listeners are executors waiting for ANY process of their type. Only one executor should wake up per signal to attempt assignment. Round-robin ensures fair distribution across executors.

Round-Robin Load Balancing: The nextExecutor map tracks which executor should receive the next signal for each target (executorType+state combination). This ensures all executors get equal opportunity to receive work, preventing any single executor from being starved or overloaded.

func (*DefaultEventHandler) HasStopped

func (handler *DefaultEventHandler) HasStopped() bool

func (*DefaultEventHandler) NumberOfListeners

func (handler *DefaultEventHandler) NumberOfListeners(executorType string, state int, location string) (int, int, int)

Additional methods for testing (not part of interface)

func (*DefaultEventHandler) Signal

func (handler *DefaultEventHandler) Signal(process *core.Process)

Signal implements EventHandler interface

func (*DefaultEventHandler) Stop

func (handler *DefaultEventHandler) Stop()

Stop implements EventHandler interface

func (*DefaultEventHandler) Subscribe

func (handler *DefaultEventHandler) Subscribe(executorType string, state int, processID string, location string, ctx context.Context) (chan *core.Process, chan error)

Subscribe implements EventHandler interface

func (*DefaultEventHandler) WaitForProcess

func (handler *DefaultEventHandler) WaitForProcess(executorType string, state int, processID string, location string, ctx context.Context) (*core.Process, error)

WaitForProcess implements EventHandler interface

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine wraps gin.Engine with additional functionality

func Default

func Default() *Engine

Default creates a new Engine instance with default middleware (Logger and Recovery)

func New

func New() *Engine

New creates a new blank Engine instance without any middleware

func NewEngine

func NewEngine() *Engine

NewEngine creates a new Engine wrapper

func NewEngineWithGin

func NewEngineWithGin(ginEngine *gin.Engine) *Engine

NewEngineWithGin creates a new Engine wrapper with an existing gin.Engine

func (*Engine) DELETE

func (e *Engine) DELETE(relativePath string, handlers ...HandlerFunc)

DELETE adds a DELETE route handler

func (*Engine) GET

func (e *Engine) GET(relativePath string, handlers ...HandlerFunc)

GET adds a GET route handler

func (*Engine) GinEngine

func (e *Engine) GinEngine() *gin.Engine

GinEngine returns the underlying gin.Engine

func (*Engine) Handler

func (e *Engine) Handler() http.Handler

Handler returns the underlying gin.Engine as http.Handler

func (*Engine) PATCH

func (e *Engine) PATCH(relativePath string, handlers ...HandlerFunc)

PATCH adds a PATCH route handler

func (*Engine) POST

func (e *Engine) POST(relativePath string, handlers ...HandlerFunc)

POST adds a POST route handler

func (*Engine) PUT

func (e *Engine) PUT(relativePath string, handlers ...HandlerFunc)

PUT adds a PUT route handler

func (*Engine) Use

func (e *Engine) Use(middleware ...HandlerFunc)

Use adds middleware to the engine

func (*Engine) UseCORS

func (e *Engine) UseCORS()

UseCORS adds CORS middleware with default configuration

func (*Engine) UseCORSWithConfig

func (e *Engine) UseCORSWithConfig(config cors.Config)

UseCORSWithConfig adds CORS middleware with custom configuration

type EngineAdapter

type EngineAdapter struct {
	// contains filtered or unexported fields
}

EngineAdapter adapts gin.Engine to the generic Engine interface

func (*EngineAdapter) DELETE

func (g *EngineAdapter) DELETE(relativePath string, handlers ...backends.HandlerFunc)

func (*EngineAdapter) GET

func (g *EngineAdapter) GET(relativePath string, handlers ...backends.HandlerFunc)

func (*EngineAdapter) Handler

func (g *EngineAdapter) Handler() http.Handler

func (*EngineAdapter) PATCH

func (g *EngineAdapter) PATCH(relativePath string, handlers ...backends.HandlerFunc)

func (*EngineAdapter) POST

func (g *EngineAdapter) POST(relativePath string, handlers ...backends.HandlerFunc)

func (*EngineAdapter) PUT

func (g *EngineAdapter) PUT(relativePath string, handlers ...backends.HandlerFunc)

func (*EngineAdapter) Use

func (g *EngineAdapter) Use(middleware ...backends.HandlerFunc)

type Factory

type Factory struct{}

Factory implements the backends.RealtimeBackend interface for WebSocket

func (*Factory) CreateConnection

func (f *Factory) CreateConnection(rawConn interface{}) (backends.RealtimeConnection, error)

CreateConnection creates a WebSocket connection from a raw websocket.Conn

func (*Factory) CreateEventHandler

func (f *Factory) CreateEventHandler(relayServer interface{}) backends.RealtimeEventHandler

CreateEventHandler creates an event handler

func (*Factory) CreateSubscriptionController

func (f *Factory) CreateSubscriptionController(eventHandler backends.RealtimeEventHandler) backends.RealtimeSubscriptionController

CreateSubscriptionController creates a subscription controller

func (*Factory) CreateTestableEventHandler

func (f *Factory) CreateTestableEventHandler(relayServer interface{}) backends.TestableRealtimeEventHandler

CreateTestableEventHandler creates a testable event handler

type HandlerFunc

type HandlerFunc func(*Context)

HandlerFunc defines the signature for route handlers in our wrapper

func BasicAuth

func BasicAuth(accounts gin.Accounts) HandlerFunc

BasicAuth returns a Basic HTTP Authorization middleware

func Logger

func Logger() HandlerFunc

Logger returns a gin.HandlerFunc for logging

func LoggerWithFormatter

func LoggerWithFormatter(f gin.LogFormatter) HandlerFunc

LoggerWithFormatter returns a gin.HandlerFunc for logging with custom formatter

func LoggerWithWriter

func LoggerWithWriter(out gin.LogFormatter, notlogged ...string) HandlerFunc

LoggerWithWriter returns a gin.HandlerFunc for logging with custom writer

func Recovery

func Recovery() HandlerFunc

Recovery middleware recovers from any panics and writes a 500 if there was one

type MiddlewareFunc

type MiddlewareFunc = HandlerFunc

MiddlewareFunc is an alias for HandlerFunc to represent middleware

type RealtimeHandler

type RealtimeHandler struct {
	// contains filtered or unexported fields
}

RealtimeHandler handles WebSocket connections for gin backend

func NewRealtimeHandler

func NewRealtimeHandler(server RealtimeServer) *RealtimeHandler

NewRealtimeHandler creates a new realtime handler for gin backend

func (*RealtimeHandler) HandleWSRequest

func (h *RealtimeHandler) HandleWSRequest(c backends.Context)

HandleWSRequest handles WebSocket upgrade and message processing for Gin

type RealtimeServer

type RealtimeServer interface {
	HandleHTTPError(c backends.Context, err error, errorCode int) bool
	ParseSignature(payload string, signature string) (string, error)
	GenerateRPCErrorMsg(err error, errorCode int) (*rpc.RPCReplyMsg, error)
	WSController() WSController
	ChannelRouter() *channel.Router
	ProcessDB() database.ProcessDatabase
	Validator() security.Validator
}

RealtimeServer interface for servers that can handle realtime connections

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps http.Server with gin integration

func NewServer

func NewServer(port int, engine *Engine) *Server

NewServer creates a new HTTP server with the given engine

func NewServerWithAddr

func NewServerWithAddr(addr string, engine *Engine) *Server

NewServerWithAddr creates a new HTTP server with the given address and engine

func (*Server) Engine

func (s *Server) Engine() *Engine

Engine returns the underlying Engine

func (*Server) GetAddr

func (s *Server) GetAddr() string

GetAddr returns the server address

func (*Server) HTTPServer

func (s *Server) HTTPServer() *http.Server

HTTPServer returns the underlying http.Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts the server and blocks until an error occurs

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS(certFile, keyFile string) error

ListenAndServeTLS starts the HTTPS server and blocks until an error occurs

func (*Server) SetAddr

func (s *Server) SetAddr(addr string)

SetAddr sets the server address

func (*Server) SetIdleTimeout

func (s *Server) SetIdleTimeout(timeout time.Duration)

SetIdleTimeout sets the idle timeout for the HTTP server

func (*Server) SetReadHeaderTimeout

func (s *Server) SetReadHeaderTimeout(timeout time.Duration)

SetReadHeaderTimeout sets the read header timeout for the HTTP server

func (*Server) SetReadTimeout

func (s *Server) SetReadTimeout(timeout time.Duration)

SetReadTimeout sets the read timeout for the HTTP server

func (*Server) SetWriteTimeout

func (s *Server) SetWriteTimeout(timeout time.Duration)

SetWriteTimeout sets the write timeout for the HTTP server

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server without interrupting active connections

func (*Server) ShutdownWithTimeout

func (s *Server) ShutdownWithTimeout(timeout time.Duration) error

ShutdownWithTimeout gracefully shuts down the server with a timeout

type ServerAdapter

type ServerAdapter struct {
	// contains filtered or unexported fields
}

ServerAdapter adapts gin.Server to the generic Server interface

func (*ServerAdapter) Engine

func (g *ServerAdapter) Engine() backends.Engine

func (*ServerAdapter) GetAddr

func (g *ServerAdapter) GetAddr() string

func (*ServerAdapter) HTTPServer

func (g *ServerAdapter) HTTPServer() *http.Server

func (*ServerAdapter) ListenAndServe

func (g *ServerAdapter) ListenAndServe() error

func (*ServerAdapter) ListenAndServeTLS

func (g *ServerAdapter) ListenAndServeTLS(certFile, keyFile string) error

func (*ServerAdapter) SetAddr

func (g *ServerAdapter) SetAddr(addr string)

func (*ServerAdapter) SetIdleTimeout

func (g *ServerAdapter) SetIdleTimeout(timeout time.Duration)

func (*ServerAdapter) SetReadHeaderTimeout

func (g *ServerAdapter) SetReadHeaderTimeout(timeout time.Duration)

func (*ServerAdapter) SetReadTimeout

func (g *ServerAdapter) SetReadTimeout(timeout time.Duration)

func (*ServerAdapter) SetWriteTimeout

func (g *ServerAdapter) SetWriteTimeout(timeout time.Duration)

func (*ServerAdapter) Shutdown

func (g *ServerAdapter) Shutdown(ctx context.Context) error

func (*ServerAdapter) ShutdownWithTimeout

func (g *ServerAdapter) ShutdownWithTimeout(timeout time.Duration) error

type ServerHelpers

type ServerHelpers struct{}

ServerHelpers provides gin-specific server helper functions

func NewServerHelpers

func NewServerHelpers() *ServerHelpers

NewServerHelpers creates new gin server helpers

func (*ServerHelpers) ExtractGinContext

func (h *ServerHelpers) ExtractGinContext(c backends.Context) (*gin.Context, bool)

ExtractGinContext extracts gin.Context from a generic Context

func (*ServerHelpers) HandleContextUnion

func (h *ServerHelpers) HandleContextUnion(c interface{}) (backends.Context, *gin.Context, bool)

HandleContextUnion handles both gin.Context and backends.Context types

func (*ServerHelpers) HandleHTTPErrorContext

func (h *ServerHelpers) HandleHTTPErrorContext(c backends.Context, err error, errorCode int) bool

HandleHTTPErrorContext handles HTTP errors for generic contexts by checking if they're gin contexts

func (*ServerHelpers) HandleHTTPErrorGin

func (h *ServerHelpers) HandleHTTPErrorGin(c *gin.Context, err error, errorCode int) bool

HandleHTTPErrorGin handles HTTP errors for gin contexts

func (*ServerHelpers) SendEmptyHTTPReplyGin

func (h *ServerHelpers) SendEmptyHTTPReplyGin(c *gin.Context, payloadType string)

SendEmptyHTTPReplyGin sends empty HTTP reply for gin contexts

func (*ServerHelpers) SendHTTPReplyGin

func (h *ServerHelpers) SendHTTPReplyGin(c *gin.Context, payloadType string, jsonString string)

SendHTTPReplyGin sends HTTP reply for gin contexts

type SubscriptionController

type SubscriptionController struct {
	// contains filtered or unexported fields
}

SubscriptionController implements the backends.RealtimeSubscriptionController interface

func (*SubscriptionController) AddProcessSubscriber

func (ctrl *SubscriptionController) AddProcessSubscriber(executorID string, process *core.Process, subscription *backends.RealtimeSubscription) error

AddProcessSubscriber implements backends.RealtimeSubscriptionController

func (*SubscriptionController) AddProcessesSubscriber

func (ctrl *SubscriptionController) AddProcessesSubscriber(executorID string, subscription *backends.RealtimeSubscription) error

AddProcessesSubscriber implements backends.RealtimeSubscriptionController

type WSController

type WSController interface {
	SubscribeProcesses(executorID string, subscription *backends.RealtimeSubscription) error
	SubscribeProcess(executorID string, subscription *backends.RealtimeSubscription) error
}

WSController interface for WebSocket handlers

type WebSocketConnection

type WebSocketConnection struct {
	// contains filtered or unexported fields
}

WebSocketConnection implements the backends.RealtimeConnection interface

func (*WebSocketConnection) Close

func (w *WebSocketConnection) Close() error

Close implements backends.RealtimeConnection

func (*WebSocketConnection) IsOpen

func (w *WebSocketConnection) IsOpen() bool

IsOpen implements backends.RealtimeConnection

func (*WebSocketConnection) WriteMessage

func (w *WebSocketConnection) WriteMessage(msgType int, data []byte) error

WriteMessage implements backends.RealtimeConnection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL