Documentation ¶
Overview ¶
Package http provides a server which implements server push system provided by the new go http package.
Index ¶
- type BasicAttr
- type BasicServeAttr
- type BasicServeHTTP
- type BasicServer
- func (s *BasicServer) Close() error
- func (s *BasicServer) Credential() octo.AuthCredential
- func (s *BasicServer) Listen(system stream.System) error
- func (s *BasicServer) Register(tm stream.StateHandlerType, hmi interface{})
- func (s *BasicServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *BasicServer) Wait()
- type BasicTransmission
- type SSEClient
- type SSEMaster
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicAttr ¶
type BasicAttr struct { Addr string Authenticate bool SkipCORS bool Headers http.Header TLSConfig *tls.Config Auth octo.AuthCredential }
BasicAttr defines a attribute struct for defining options for the WebBasicServer struct.
type BasicServeAttr ¶
type BasicServeAttr struct { Authenticate bool SkipCORS bool Instruments octo.Instrumentation Info octo.Contact Auth octo.Credentials System stream.System Pub *stream.Pub }
BasicServeAttr defines a attribute which holds configuration fields for a BasicServeHTTP.
type BasicServeHTTP ¶
type BasicServeHTTP struct { Attr BasicServeAttr // contains filtered or unexported fields }
BasicServeHTTP provides a structure which implements the http.Handler and provides the core server which implements the needed functionality to use the streams.System interface. It is provided as a seperate module to allow flexibility with user created server and routes for http requests.
func NewBasicServeHTTP ¶
func NewBasicServeHTTP(attr BasicServeAttr) *BasicServeHTTP
NewBasicServeHTTP returns a new instance of the BasicServeHTTP object.
func (*BasicServeHTTP) Contact ¶
func (s *BasicServeHTTP) Contact() octo.Contact
Contact returns the info object associated with this server.
func (*BasicServeHTTP) ServeHTTP ¶
func (s *BasicServeHTTP) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler.ServeHTTP interface method to handle http request converted to websockets request.
type BasicServer ¶
type BasicServer struct { Attr BasicAttr // contains filtered or unexported fields }
BasicServer defines a struct implements the http.ServeHTTP interface which handles servicing http requests for websockets.
func New ¶
func New(instruments octo.Instrumentation, attr BasicAttr) *BasicServer
New returns a new instance of a BasicServer.
func (*BasicServer) Close ¶
func (s *BasicServer) Close() error
Close ends the websocket connection and ensures all requests are finished.
func (*BasicServer) Credential ¶
func (s *BasicServer) Credential() octo.AuthCredential
Credential return the giving credentails of the provided server.
func (*BasicServer) Listen ¶
func (s *BasicServer) Listen(system stream.System) error
Listen begins the initialization of the websocket server.
func (*BasicServer) Register ¶
func (s *BasicServer) Register(tm stream.StateHandlerType, hmi interface{})
Register registers the handler for a given handler.
func (*BasicServer) ServeHTTP ¶
func (s *BasicServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler.ServeHTTP interface method to handle http request converted to websockets request.
func (*BasicServer) Wait ¶
func (s *BasicServer) Wait()
Wait awaits the closure of the giving client.
type BasicTransmission ¶
type BasicTransmission struct { Request *http.Request Writer http.ResponseWriter // contains filtered or unexported fields }
BasicTransmission defines a struct to hold the request and response object. All HTTP Request are expected to use the 'Authorization' header which will contain the `SCHEME TOKEN:APIKEY:APIDATA'` which will then be used for authentication if the
func (*BasicTransmission) Close ¶
func (t *BasicTransmission) Close() error
Close ends the internal conneciton.
func (*BasicTransmission) Contact ¶
func (t *BasicTransmission) Contact() (octo.Contact, octo.Contact)
Contact returns the giving information for the internal client and server.
func (*BasicTransmission) Ctx ¶
func (t *BasicTransmission) Ctx() context.Context
Ctx returns the context that is related to this object.
type SSEClient ¶
SSEClient defines a struct which implements the http.Handler interface for handling http server-sent requests.
func NewSSEClient ¶
func NewSSEClient(instruments octo.Instrumentation, auth octo.Authenticator, pub *stream.Pub, sm *SSEMaster, info octo.Contact, notifications chan []byte, closer chan struct{}) *SSEClient
NewSSEClient returns a new instance of a SSEServer.
type SSEMaster ¶
type SSEMaster struct {
// contains filtered or unexported fields
}
SSEMaster defines a structure which manages multiple SSE(Server-Side Event) and ensures data is being delivered to all.
func NewSSEMaster ¶
func NewSSEMaster(inst octo.Instrumentation, base octo.Contact, auth octo.Authenticator, header map[string]string) *SSEMaster
NewSSEMaster returns a new instance of a SSEMaster.
func (*SSEMaster) Close ¶
Close ends all connections and awaits all stopping of clients gorountines.
func (*SSEMaster) Register ¶
func (s *SSEMaster) Register(tm stream.StateHandlerType, hmi interface{})
Register registers the handler for a given handler.