Documentation
¶
Index ¶
- type ApplicationRequestHandlerFunction
- type ConnEvent
- type RawConnection
- type RawConnectionListener
- func NewTcpConnectionListener(addr string) (RawConnectionListener, error)
- func NewWebSocketConnectionFromExistingHttpServer(httpServer *http.Server, handler *mux.Router, endpoint string, ...) (RawConnectionListener, error)
- func NewWebSocketConnectionListener(addr string, endpoint string, allowedOrigins []string) (RawConnectionListener, error)
- type StompConfig
- type StompConn
- type StompServer
- type StompSessionEventType
- type SubscribeHandlerFunction
- type UnsubscribeHandlerFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RawConnection ¶
type RawConnectionListener ¶
type RawConnectionListener interface {
// Blocks until a new RawConnection is established.
Accept() (RawConnection, error)
// Stops the connection listener.
Close() error
}
func NewTcpConnectionListener ¶
func NewTcpConnectionListener(addr string) (RawConnectionListener, error)
func NewWebSocketConnectionListener ¶
func NewWebSocketConnectionListener(addr string, endpoint string, allowedOrigins []string) (RawConnectionListener, error)
type StompConfig ¶
type StompConfig interface {
HeartBeat() int64
AppDestinationPrefix() []string
IsAppRequestDestination(destination string) bool
}
func NewStompConfig ¶
func NewStompConfig(heartBeatMs int64, appDestinationPrefix []string) StompConfig
type StompConn ¶
type StompConn interface {
// Return unique connection Id string
GetId() string
SendFrameToSubscription(f *frame.Frame, sub *subscription)
Close()
}
func NewStompConn ¶
func NewStompConn(rawConnection RawConnection, config StompConfig, events chan *ConnEvent) StompConn
type StompServer ¶
type StompServer interface {
// starts the server
Start()
// stops the server
Stop()
// sends a message to a given stomp topic destination
SendMessage(destination string, messageBody []byte)
// sends a message to a single connection client
SendMessageToClient(connectionId string, destination string, messageBody []byte)
// registers a callback for stomp subscribe events
OnSubscribeEvent(callback SubscribeHandlerFunction)
// registers a callback for stomp unsubscribe events
OnUnsubscribeEvent(callback UnsubscribeHandlerFunction)
// registers a callback for application requests
OnApplicationRequest(callback ApplicationRequestHandlerFunction)
// SetConnectionEventCallback is used to set up a callback when certain STOMP session events happen
// such as ConnectionStarting, ConnectionClosed, SubscribeToTopic, UnsubscribeFromTopic and IncomingMessage.
SetConnectionEventCallback(connEventType StompSessionEventType, cb func(connEvent *ConnEvent))
}
func NewStompServer ¶
func NewStompServer(listener RawConnectionListener, config StompConfig) StompServer
type StompSessionEventType ¶
type StompSessionEventType int
const ( ConnectionStarting StompSessionEventType = iota ConnectionEstablished ConnectionClosed SubscribeToTopic UnsubscribeFromTopic IncomingMessage )
Click to show internal directories.
Click to hide internal directories.