nats_http

package module
v0.0.0-...-2bf4f96 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2017 License: MIT Imports: 16 Imported by: 0

README

nats-http

HTTP gateway for nats.io. Supports login by JWT and json/protobuf message formats.

Installation

go get github.com/akaumov/nats-http

Unless otherwise noted, the source files are distributed under the MIT License found in the LICENSE.txt file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultMuxRequest

func DefaultMuxRequest(request *http.Request) (string, bool)

func DefaultPackRequest

func DefaultPackRequest(userId string, deviceId string, packetFormat string, request *http.Request) ([]byte, error)

Types

type Config

type Config struct {
	ListenInterface string `json:"listenInterface"`
	UrlPattern      string `json:"urlPattern"`
	PacketFormat    string `json:"packetFormat"`
	Timeout         int64  `json:"timeout"`
	JwtSecret       string `json:"jwtSecret"`

	NatsAddress  string `json:"natsAddress"`
	NatsPoolSize int    `json:"natsPoolSize"`
}

type MuxRequestFunc

type MuxRequestFunc func(request *http.Request) (string, bool)

type NatsHttp

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

func New

func New(config *Config) *NatsHttp

func NewCustom

func NewCustom(config *Config, muxRequest MuxRequestFunc, packRequestHook PackRequestFunc) *NatsHttp

func (*NatsHttp) Start

func (h *NatsHttp) Start()

func (*NatsHttp) Stop

func (h *NatsHttp) Stop()

type PackRequestFunc

type PackRequestFunc func(userId string, deviceId string, packetFormat string, request *http.Request) ([]byte, error)

Directories

Path Synopsis
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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