natscliws

package module
v0.0.0-...-dbeb21d Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

go-nats-cli-ws

Go nats.io client via websockets proxy

package main

import (
    mqs "github.com/9glt/go-nats-cli-ws"
)

func main() {
    conn, err := mqs.New("wss://host.domain.tld/path?token=tok", "nats://user:pass@127.0.0.1:4222")
    if err != nil {
        panic(err)
    }
    conn.Publish("topic", []byte("message"))
    // ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MQ

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

func New

func New(ws string, n string) (*MQ, error)

New connects to nats via websocket dialer

func (*MQ) Flush

func (mq *MQ) Flush() error

func (*MQ) FlushTimeout

func (mq *MQ) FlushTimeout(d time.Duration) error

func (*MQ) Publish

func (mq *MQ) Publish(t string, pl []byte) error

func (*MQ) QueueSubscribe

func (mq *MQ) QueueSubscribe(t, q string, cb MsgHandler) (*Subscription, error)

func (*MQ) Subscribe

func (mq *MQ) Subscribe(t string, cb MsgHandler) (*Subscription, error)

func (*MQ) UnderlyingConn

func (mq *MQ) UnderlyingConn() *nats.Conn

type Msg

type Msg struct {
	nats.Msg
}

type MsgHandler

type MsgHandler func(msg *Msg)

type Subscription

type Subscription struct {
	nats.Subscription
}

Jump to

Keyboard shortcuts

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