Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response interface {
SetCommonResponse(response *types.RestResponse)
}
Response defines methods for a common response structure
type Transport ¶
type Transport interface { Call(ctx context.Context, domain string, isBroker bool, method string, path string, request interface{}, response Response, requestJson bool) error Close() error }
Transport is an interface that represents a generic transport layer. It has a single method, called Call, which accepts a context, a method name, a path, a request payload and a response struct. The method should perform a call to some remote service using the provided information and fill the response with the obtained data. In case of any errors during this process, the method should return them to the caller.
type WebSocketMessageCallback ¶
type WebSocketMessageCallback interface { // OnMessage handles the incoming WebSocket messages OnMessage(message *types.WsMessage) error }
WebSocketMessageCallback defines a method for handling WebSocket messages
type WebSocketService ¶
type WebSocketService interface { // Start starts the WebSocket service and handles incoming WebSocket messages. Start() error // Stop stops the WebSocket service Stop() error // Subscribe to a topic with a provided message callback Subscribe(topic string, args []string, callback WebSocketMessageCallback) (string, error) // Unsubscribe from a topic Unsubscribe(id string) error }
WebSocketService defines methods for subscribing to and unsubscribing from topics in a WebSocket connection
type WebsocketTransport ¶
type WebsocketTransport interface { Start() error Stop() error Write(context.Context, *types.WsMessage) <-chan error Read() <-chan *types.WsMessage Reconnected() <-chan struct{} }
WebsocketTransport defines methods required for managing a WebSocket connection. This includes connecting to the WebSocket, closing the connection, writing messages, and reading from the connection.
type WsToken ¶
type WsToken struct { Token string `json:"token"` PingInterval int64 `json:"pingInterval"` Endpoint string `json:"endpoint"` Protocol string `json:"protocol"` Encrypt bool `json:"encrypt"` PingTimeout int64 `json:"pingTimeout"` }
WsToken holds the token and API endpoint for a WebSocket connection
type WsTokenProvider ¶
WsTokenProvider defines a method for retrieving a WebSocket token