hsocks

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIdentificationHeader = "X-SSE-Client-Id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpServlet

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

func ManagedHttpServlet

func ManagedHttpServlet(
	ctx context.Context,
	logger sabuhp.Logger,
	decoder sabuhp.HttpDecoder,
	encoder sabuhp.HttpEncoder,
	optionalHeaders sabuhp.HeaderModifications,
	bus sabuhp.MessageBus,
) *HttpServlet

func (*HttpServlet) Bus

func (htp *HttpServlet) Bus(bus sabuhp.MessageBus)

func (*HttpServlet) Handle

func (htp *HttpServlet) Handle(w http.ResponseWriter, r *http.Request, p sabuhp.Params)

func (*HttpServlet) HandleMessage

func (htp *HttpServlet) HandleMessage(
	w http.ResponseWriter,
	r *http.Request,
	p sabuhp.Params,
	asEvent string,
	handler sabuhp.SocketMessageHandler,
)

HandleMessage implements necessary logic to handle an incoming request and response life cycle.

func (*HttpServlet) HandleWithResponder

func (htp *HttpServlet) HandleWithResponder(w http.ResponseWriter, r *http.Request, p sabuhp.Params, handler sabuhp.SocketMessageHandler)

func (*HttpServlet) ServeHTTP

func (htp *HttpServlet) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

It collects all values from http.Request.ParseForm() as params map and calls them with HttpServlet.Handle.

func (*HttpServlet) Stream

func (htp *HttpServlet) Stream(server sabuhp.SocketService)

type SendClient

type SendClient struct {
	Route         string
	RequestMethod string
	// contains filtered or unexported fields
}

func CreateClient added in v0.6.3

func CreateClient(
	ctx context.Context,
	addr string,
	method string,
	codec sabuhp.Codec,
	logger sabuhp.Logger,
	client sabuhp.HttpClient,
) *SendClient

func CreateClient2 added in v0.6.3

func CreateClient2(
	ctx context.Context,
	addr string,
	method string,
	codec sabuhp.Codec,
	logger sabuhp.Logger,
) *SendClient

func NewClient

func NewClient(
	ctx context.Context,
	id nxid.ID,
	route string,
	maxRetries int,
	method string,
	codec sabuhp.Codec,
	retryFn sabuhp.RetryFunc,
	logger sabuhp.Logger,
	reqClient sabuhp.HttpClient,
) *SendClient

func (*SendClient) CloneForMethod added in v0.6.3

func (sc *SendClient) CloneForMethod(method string) *SendClient

func (*SendClient) Close added in v0.6.3

func (sc *SendClient) Close()

func (*SendClient) ID added in v0.6.3

func (sc *SendClient) ID() nxid.ID

func (*SendClient) Send

func (sc *SendClient) Send(msgs ...sabuhp.Message)

func (*SendClient) SendMessageAsMethod added in v0.6.3

func (sc *SendClient) SendMessageAsMethod(method string, msg sabuhp.Message) error

func (*SendClient) Start added in v0.6.3

func (sc *SendClient) Start()

func (*SendClient) Stop added in v0.6.3

func (sc *SendClient) Stop()

type ServletSocket

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

func NewServletSocket

func NewServletSocket(
	ctx context.Context,
	clientId string,
	streams *sabuhp.SocketServers,
	r *http.Request,
	w http.ResponseWriter,
	params sabuhp.Params,
	logger sabuhp.Logger,
	decoder sabuhp.HttpDecoder,
	encoder sabuhp.HttpEncoder,
	headerMod sabuhp.HeaderModifications,
	asEvent string,
	handler sabuhp.SocketMessageHandler,
) *ServletSocket

func (*ServletSocket) Conn

func (se *ServletSocket) Conn() sabuhp.Conn

func (*ServletSocket) ID

func (se *ServletSocket) ID() nxid.ID

func (*ServletSocket) Listen

func (se *ServletSocket) Listen(handler sabuhp.SocketMessageHandler)

func (*ServletSocket) LocalAddr

func (se *ServletSocket) LocalAddr() net.Addr

func (*ServletSocket) RemoteAddr

func (se *ServletSocket) RemoteAddr() net.Addr

func (*ServletSocket) Send

func (se *ServletSocket) Send(msgs ...sabuhp.Message)

func (*ServletSocket) Start

func (se *ServletSocket) Start() error

func (*ServletSocket) Stat

func (se *ServletSocket) Stat() sabuhp.SocketStat

func (*ServletSocket) Stop

func (se *ServletSocket) Stop()

func (*ServletSocket) Wait

func (se *ServletSocket) Wait()

Jump to

Keyboard shortcuts

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