server

package
v0.0.0-...-3245bf1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotAuthorized = errors.New("stomp: not authorized")

ErrNotAuthorized is returned when the peer connection is not authorized to establish a connection with the STOMP server.

Functions

This section is empty.

Types

type Authorizer

type Authorizer func(*stomp.Message) error

Authorizer is a callback function used to authenticate a peer connection prior to establishing the session. If the callback returns a non-nil error an error message is sent to the peer and the connection is closed.

func BasicAuth

func BasicAuth(username, password string) Authorizer

BasicAuth is a authorization callback function that authorizes the peer connection using a basic, global username and password.

type Option

type Option func(*Server)

Option configures server options.

func WithAuth

func WithAuth(auth Authorizer) Option

WithAuth returns an Option which configures custom authorization for the STOMP server.

func WithCredentials

func WithCredentials(username, password string) Option

WithCredentials returns an Option which configures basic authorization using the given username and password

type Server

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

Server ...

func NewServer

func NewServer(options ...Option) *Server

NewServer returns a new STOMP server.

func (*Server) Client

func (s *Server) Client() *stomp.Client

Client returns a stomp.Client that has a direct peer connection to the server.

func (*Server) HandleDests

func (s *Server) HandleDests(w http.ResponseWriter, r *http.Request)

HandleDests writes a JSON-encoded list of destinations to the http.Request.

func (*Server) HandleSessions

func (s *Server) HandleSessions(w http.ResponseWriter, r *http.Request)

HandleSessions writes a JSON-encoded list of sessions to the http.Request.

func (*Server) Serve

func (s *Server) Serve(conn net.Conn)

Serve accepts incoming net.Conn requests.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP accepts incoming http.Request, upgrades to a websocket and begins sending and receiving STOMP messages.

Jump to

Keyboard shortcuts

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