http

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

Grav Transport: HTTP

This is a simple transport plugin for Grav that uses basic HTTP/S.

Handler functions are made available for Vektor and http.Server, all managed by the Transport object that emits events to a set of HTTP endpoints.

grav-transport-http is in prototype stages, not ready for use

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	URL *url.URL
	// contains filtered or unexported fields
}

Endpoint represents an HTTP endpoint that is "connected"

func (*Endpoint) CanReplace

func (e *Endpoint) CanReplace() bool

CanReplace returns true if the connection can be replaced

func (*Endpoint) Close

func (e *Endpoint) Close() error

Close "closes" the connection

func (*Endpoint) DoIncomingHandshake

func (e *Endpoint) DoIncomingHandshake(callback grav.HandshakeCallback) (*grav.TransportHandshake, error)

DoIncomingHandshake does an incoming handshake

func (*Endpoint) DoOutgoingHandshake

func (e *Endpoint) DoOutgoingHandshake(handshake *grav.TransportHandshake) (*grav.TransportHandshakeAck, error)

DoOutgoingHandshake does an outgoing handshake

func (*Endpoint) Send

func (e *Endpoint) Send(msg grav.Message) error

Send sends a message to the connection

func (*Endpoint) Start

func (e *Endpoint) Start(recvFunc grav.ReceiveFunc, signaler *grav.WithdrawSignaler)

Start "starts" the connection

type Transport

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

Transport is an HTTP handler manager that pushes messages into a bus

func New

func New() *Transport

New creates a new http transport

func (*Transport) ConnectBridgeTopic added in v0.4.0

func (t *Transport) ConnectBridgeTopic(topic string) (grav.TopicConnection, error)

ConnectBridgeTopic connects to a topic if the transport is a bridge

func (*Transport) CreateConnection

func (t *Transport) CreateConnection(endpoint string) (grav.Connection, error)

CreateConnection adds an HTTP/S endpoint to emit messages to

func (*Transport) HTTPHandlerFunc

func (t *Transport) HTTPHandlerFunc() http.HandlerFunc

HTTPHandlerFunc returns an http.HandlerFunc for incoming messages

func (*Transport) HandlerFunc

func (t *Transport) HandlerFunc() vk.HandlerFunc

HandlerFunc returns a vk handlerFunc for incoming messages use HTTPHAndlerFunc for a regular Go http.HandlerFunc

func (*Transport) Setup

func (t *Transport) Setup(opts *grav.TransportOpts, connFunc grav.ConnectFunc, findFunc grav.FindFunc) error

Setup sets the transport up for connections

func (*Transport) Type added in v0.4.0

func (t *Transport) Type() grav.TransportType

Type returns the transport's type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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