xconn

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 33 Imported by: 4

README

xconn

WAMP v2 Router and Client for go.

Installation

To install xconn, use the following command:

go get github.com/xconnio/xconn-go

Client

Creating a client:

package main

import (
	"context"
	"log"

	"github.com/xconnio/xconn-go"
)

func main() {
	session, err := xconn.ConnectAnonymous(context.Background(), "ws://localhost:8080/ws", "realm1")
	if err != nil {
		log.Fatal(err)
	}
}

Once the session is established, you can perform WAMP actions. Below are examples of all 4 WAMP operations:

Subscribe to a topic
func exampleSubscribe(session *xconn.Session) {
    subscribeResponse := session.Subscribe("io.xconn.example", eventHandler).Do()
    if subscribeResponse.Err != nil {
        log.Fatalf("Failed to subscribe: %v", subscribeResponse.Err)
    }
    log.Printf("Subscribed to topic io.xconn.example")
}

func eventHandler(evt *xconn.Event) {
    fmt.Printf("Event Received: args=%s, kwargs=%s, details=%s", evt.Args, evt.Kwargs, evt.Details)
}
Publish to a topic
func examplePublish(session *xconn.Session) {
    publishResponse := session.Publish("io.xconn.example").Arg("test").Do()
    if publishResponse.Err != nil {
        log.Fatalf("Failed to publish: %v", publishResponse.Err)
    }
    log.Printf("Published to topic io.xconn.example")
}
Register a procedure
func exampleRegister(session *xconn.Session) {
    registerResponse := session.Register("io.xconn.example", invocationHandler).Do()
    if registerResponse.Err != nil {
        log.Fatalf("Failed to register: %v", registerResponse.Err)
    }
    log.Printf("Registered procedure io.xconn.example")
}

func invocationHandler(ctx context.Context, inv *xconn.Invocation) *xconn.InvocationResult {
    return xconn.NewInvocationResult()
}
Call a procedure
func exampleCall(session *xconn.Session) {
    callResponse := session.Call("io.xconn.example").Arg("Hello World!").Do()
    if callResponse.Err != nil {
        log.Fatalf("Failed to call: %v", callResponse.Err)
    }
    log.Printf("Call result: args=%s, kwargs=%s, details=%s", callResponse.Args, callResponse.Kwargs, callResponse.Details)
}
Authentication

Authentication is straightforward.

Ticket Auth

session, err := xconn.ConnectTicket(context.Background(), "ws://localhost:8080/ws", "realm1", "authID", "ticket")
if err != nil {
    log.Fatalf("Failed to connect: %v", err)
}

Challenge Response Auth

session, err := xconn.ConnectCRA(context.Background(), "ws://localhost:8080/ws", "realm1", "authID", "secret")
if err != nil {
	log.Fatalf("Failed to connect: %v", err)
}

Cryptosign Auth

session, err := xconn.ConnectCryptosign(context.Background(), "ws://localhost:8080/ws", "realm1", "authID", "privateKey")
if err != nil {
    log.Fatalf("Failed to connect: %v", err)
}

Standalone Router

This repo contains a command-line tool to run the router with a static config.

git clone git@github.com:xconnio/xconn-go
cd xconn-go
make build
./nxt init
./nxt start

After running nxt init the static yaml config will appear at .nxt/config.yaml

For more detailed examples or usage, refer to the examples folder of the project.

Documentation

Index

Constants

View Source
const (
	ManagementProcedureStatsStatusSet = "io.xconn.mgmt.stats.status.set"
	ManagementProcedureStatsStatusGet = "io.xconn.mgmt.stats.status.get"
	ManagementProcedureStatsGet       = "io.xconn.mgmt.stats.get"

	ManagementProcedureGC = "io.xconn.mgmt.runtime.force_gc"

	ManagementTopicStats = "io.xconn.mgmt.stats.on_update"

	ManagementProcedureSetLogLevel = "io.xconn.mgmt.log.level.set"
	ManagementProcedureGetLogLevel = "io.xconn.mgmt.log.level.get"

	ManagementProcedureListRealms  = "io.xconn.mgmt.realm.list"
	ManagementProcedureListSession = "io.xconn.mgmt.session.list"
	ManagementProcedureKillSession = "io.xconn.mgmt.session.kill"

	ManagementProcedureMaxProcsSet   = "io.xconn.mgmt.runtime.gomaxprocs.set"
	ManagementProcedureMaxProcsGet   = "io.xconn.mgmt.runtime.gomaxprocs.get"
	ManagementProcedureGoroutinesGet = "io.xconn.mgmt.runtime.goroutines.get"

	ManagementProcedureSessionLogSet  = "io.xconn.mgmt.session.log.set"
	ManagementTopicSessionLogTemplate = "io.xconn.mgmt.session.log.%d.on_update"
)
View Source
const (
	MetaProcedureSessionKill           = "wamp.session.kill"
	MetaProcedureSessionCount          = "wamp.session.count"
	MetaProcedureSessionList           = "wamp.session.list"
	MetaProcedureSessionGet            = "wamp.session.get"
	MetaProcedureSessionKillByAuthID   = "wamp.session.kill_by_authid"
	MetaProcedureSessionKillByAuthRole = "wamp.session.kill_by_authrole"
	MetaProcedureSessionKillAll        = "wamp.session.kill_all"

	MetaTopicSessionJoin  = "wamp.session.on_join"
	MetaTopicSessionLeave = "wamp.session.on_leave"
)
View Source
const (
	ClientOutQueueSizeDefault = 16
	RouterOutQueueSizeDefault = 64
)
View Source
const (
	LogLevelTrace = LogLevel(log.TraceLevel)
	LogLevelDebug = LogLevel(log.DebugLevel)
	LogLevelInfo  = LogLevel(log.InfoLevel)
	LogLevelWarn  = LogLevel(log.WarnLevel)
	LogLevelError = LogLevel(log.ErrorLevel)
)
View Source
const (
	JsonWebsocketProtocol    = "wamp.2.json"
	MsgpackWebsocketProtocol = "wamp.2.msgpack"
	CborWebsocketProtocol    = "wamp.2.cbor"

	CloseGoodByeAndOut  = "wamp.close.goodbye_and_out"
	CloseCloseRealm     = "wamp.close.close_realm"
	CloseSystemShutdown = "wamp.close.system_shutdown"

	ErrNetworkFailure = "wamp.error.network_failure"
)
View Source
const ErrNoResult = "io.xconn.no_result"
View Source
const ManagementRealm = "io.xconn.mgmt"

Variables

Functions

func NewInMemoryPeerPair

func NewInMemoryPeerPair(outQueueSize int) (Peer, Peer)

func ReadHello

func ReadHello(peer Peer, serializer serializers.Serializer) (*messages.Hello, error)

func ReadMessage

func ReadMessage(peer Peer, serializer serializers.Serializer) (messages.Message, error)

func SerializersByWSSubProtocol

func SerializersByWSSubProtocol() map[string]serializers.Serializer

func WriteMessage

func WriteMessage(peer Peer, message messages.Message, serializer serializers.Serializer) error

Types

type Authorizer

type Authorizer interface {
	Authorize(baseSession BaseSession, msg messages.Message) (bool, error)
}

type BaseSession

type BaseSession interface {
	ID() uint64
	Realm() string
	AuthID() string
	AuthRole() string
	AuthMethod() string
	AuthExtra() map[string]any

	Serializer() serializers.Serializer
	NetConn() net.Conn
	Read() ([]byte, error)
	Write([]byte) error
	TryWrite([]byte) (bool, error)
	ReadMessage() (messages.Message, error)
	WriteMessage(messages.Message) error
	TryWriteMessage(messages.Message) (bool, error)
	EnableLogPublishing(session *Session, topic string)
	DisableLogPublishing()
	Close() error
}

func Accept

func Accept(peer Peer, hello *messages.Hello, serializer serializers.Serializer,
	authenticator auth.ServerAuthenticator) (BaseSession, error)

func ConnectInMemoryBase

func ConnectInMemoryBase(router *Router, realm, authID, authRole string,
	serializer serializers.Serializer, outQueueSize int) (BaseSession, error)

func Join

func Join(cl Peer, realm string, serializer serializers.Serializer,
	authenticator auth.ClientAuthenticator) (BaseSession, error)

func NewBaseSession

func NewBaseSession(id uint64, realm, authID, authRole, authMethod string, authExtra map[string]any, cl Peer,
	serializer serializers.Serializer) BaseSession

type CallRequest

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

func (*CallRequest) Arg

func (c *CallRequest) Arg(arg any) *CallRequest

func (*CallRequest) Args

func (c *CallRequest) Args(args ...any) *CallRequest

func (*CallRequest) Do

func (c *CallRequest) Do() CallResponse

func (*CallRequest) DoContext

func (c *CallRequest) DoContext(ctx context.Context) CallResponse

func (*CallRequest) Kwarg

func (c *CallRequest) Kwarg(key string, value any) *CallRequest

func (*CallRequest) Kwargs

func (c *CallRequest) Kwargs(kwargs map[string]any) *CallRequest

func (*CallRequest) Option

func (c *CallRequest) Option(key string, value any) *CallRequest

func (*CallRequest) Options

func (c *CallRequest) Options(options map[string]any) *CallRequest

func (*CallRequest) ProgressReceiver

func (c *CallRequest) ProgressReceiver(handler ProgressReceiver) *CallRequest

func (*CallRequest) ProgressSender

func (c *CallRequest) ProgressSender(handler ProgressSender) *CallRequest

type CallResponse

type CallResponse struct {
	Err error
	// contains filtered or unexported fields
}

func (*CallResponse) ArgBool

func (c *CallResponse) ArgBool(index int) (bool, error)

func (*CallResponse) ArgBoolOr

func (c *CallResponse) ArgBoolOr(index int, def bool) bool

func (*CallResponse) ArgBytes

func (c *CallResponse) ArgBytes(index int) ([]byte, error)

func (*CallResponse) ArgBytesOr

func (c *CallResponse) ArgBytesOr(index int, def []byte) []byte

func (*CallResponse) ArgDict

func (c *CallResponse) ArgDict(index int) (Dict, error)

func (*CallResponse) ArgDictOr

func (c *CallResponse) ArgDictOr(index int, def Dict) Dict

func (*CallResponse) ArgFloat64

func (c *CallResponse) ArgFloat64(index int) (float64, error)

func (*CallResponse) ArgFloat64Or

func (c *CallResponse) ArgFloat64Or(index int, def float64) float64

func (*CallResponse) ArgInt64

func (c *CallResponse) ArgInt64(index int) (int64, error)

func (*CallResponse) ArgInt64Or

func (c *CallResponse) ArgInt64Or(index int, def int64) int64

func (*CallResponse) ArgList

func (c *CallResponse) ArgList(index int) (List, error)

func (*CallResponse) ArgListOr

func (c *CallResponse) ArgListOr(index int, def List) List

func (*CallResponse) ArgString

func (c *CallResponse) ArgString(index int) (string, error)

func (*CallResponse) ArgStringOr

func (c *CallResponse) ArgStringOr(index int, def string) string

func (*CallResponse) ArgUInt64

func (c *CallResponse) ArgUInt64(index int) (uint64, error)

func (*CallResponse) ArgUInt64Or

func (c *CallResponse) ArgUInt64Or(index int, def uint64) uint64

func (*CallResponse) Args

func (c *CallResponse) Args() []any

func (*CallResponse) ArgsLen

func (c *CallResponse) ArgsLen() int

func (*CallResponse) ArgsStruct

func (c *CallResponse) ArgsStruct(out any) error

func (*CallResponse) Details

func (c *CallResponse) Details() map[string]any

func (*CallResponse) KwargBool

func (c *CallResponse) KwargBool(key string) (bool, error)

func (*CallResponse) KwargBoolOr

func (c *CallResponse) KwargBoolOr(key string, def bool) bool

func (*CallResponse) KwargBytes

func (c *CallResponse) KwargBytes(key string) ([]byte, error)

func (*CallResponse) KwargBytesOr

func (c *CallResponse) KwargBytesOr(key string, def []byte) []byte

func (*CallResponse) KwargDict

func (c *CallResponse) KwargDict(key string) (Dict, error)

func (*CallResponse) KwargDictOr

func (c *CallResponse) KwargDictOr(key string, def Dict) Dict

func (*CallResponse) KwargFloat64

func (c *CallResponse) KwargFloat64(key string) (float64, error)

func (*CallResponse) KwargFloat64Or

func (c *CallResponse) KwargFloat64Or(key string, def float64) float64

func (*CallResponse) KwargInt64

func (c *CallResponse) KwargInt64(key string) (int64, error)

func (*CallResponse) KwargInt64Or

func (c *CallResponse) KwargInt64Or(key string, def int64) int64

func (*CallResponse) KwargListOr

func (c *CallResponse) KwargListOr(key string, def List) List

func (*CallResponse) KwargString

func (c *CallResponse) KwargString(key string) (string, error)

func (*CallResponse) KwargStringOr

func (c *CallResponse) KwargStringOr(key string, def string) string

func (*CallResponse) KwargUInt64

func (c *CallResponse) KwargUInt64(key string) (uint64, error)

func (*CallResponse) KwargUInt64Or

func (c *CallResponse) KwargUInt64Or(key string, def uint64) uint64

func (*CallResponse) Kwargs

func (c *CallResponse) Kwargs() map[string]any

func (*CallResponse) KwargsLen

func (c *CallResponse) KwargsLen() int

func (*CallResponse) KwargsList

func (c *CallResponse) KwargsList(key string) (List, error)

func (*CallResponse) KwargsStruct

func (c *CallResponse) KwargsStruct(out any) error

type Client

type Client struct {
	Authenticator  auth.ClientAuthenticator
	SerializerSpec SerializerSpec
	NetDial        func(ctx context.Context, network, addr string) (net.Conn, error)

	DialTimeout       time.Duration
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, uri string, realm string) (*Session, error)

type Dict

type Dict map[string]Value

func NewDict

func NewDict(values map[string]any) Dict

func (Dict) Bool

func (d Dict) Bool(key string) (bool, error)

func (Dict) BoolOr

func (d Dict) BoolOr(key string, def bool) bool

func (Dict) Bytes

func (d Dict) Bytes(key string) ([]byte, error)

func (Dict) BytesOr

func (d Dict) BytesOr(key string, def []byte) []byte

func (Dict) Decode

func (d Dict) Decode(out any) error

func (Dict) Dict

func (d Dict) Dict(key string) (Dict, error)

func (Dict) DictOr

func (d Dict) DictOr(key string, def Dict) Dict

func (Dict) Float64

func (d Dict) Float64(key string) (float64, error)

func (Dict) Float64Or

func (d Dict) Float64Or(key string, def float64) float64

func (Dict) Get

func (d Dict) Get(key string) (Value, error)

func (Dict) GetOr

func (d Dict) GetOr(key string, def any) Value

func (Dict) Has

func (d Dict) Has(key string) bool

func (Dict) Int64

func (d Dict) Int64(key string) (int64, error)

func (Dict) Int64Or

func (d Dict) Int64Or(key string, def int64) int64

func (Dict) Len

func (d Dict) Len() int

func (Dict) List

func (d Dict) List(key string) (List, error)

func (Dict) ListOr

func (d Dict) ListOr(key string, def List) List

func (Dict) Raw

func (d Dict) Raw() map[string]any

func (Dict) String

func (d Dict) String(key string) (string, error)

func (Dict) StringOr

func (d Dict) StringOr(key string, def string) string

func (Dict) UInt64

func (d Dict) UInt64(key string) (uint64, error)

func (Dict) UInt64Or

func (d Dict) UInt64Or(key string, def uint64) uint64

type Error

type Error struct {
	URI    string
	Args   []any
	Kwargs map[string]any
}

func (*Error) Error

func (e *Error) Error() string

type Event

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

func NewEvent

func NewEvent(args []any, kwargs map[string]any, details map[string]any) *Event

func (*Event) ArgBool

func (e *Event) ArgBool(index int) (bool, error)

func (*Event) ArgBoolOr

func (e *Event) ArgBoolOr(index int, def bool) bool

func (*Event) ArgBytes

func (e *Event) ArgBytes(index int) ([]byte, error)

func (*Event) ArgBytesOr

func (e *Event) ArgBytesOr(index int, def []byte) []byte

func (*Event) ArgDict

func (e *Event) ArgDict(index int) (dict Dict, err error)

func (*Event) ArgDictOr

func (e *Event) ArgDictOr(index int, def Dict) Dict

func (*Event) ArgFloat64

func (e *Event) ArgFloat64(index int) (float64, error)

func (*Event) ArgFloat64Or

func (e *Event) ArgFloat64Or(index int, def float64) float64

func (*Event) ArgInt64

func (e *Event) ArgInt64(index int) (int64, error)

func (*Event) ArgInt64Or

func (e *Event) ArgInt64Or(index int, def int64) int64

func (*Event) ArgList

func (e *Event) ArgList(index int) (list List, err error)

func (*Event) ArgListOr

func (e *Event) ArgListOr(index int, def List) List

func (*Event) ArgString

func (e *Event) ArgString(index int) (string, error)

func (*Event) ArgStringOr

func (e *Event) ArgStringOr(index int, def string) string

func (*Event) ArgUInt64

func (e *Event) ArgUInt64(index int) (uint64, error)

func (*Event) ArgUInt64Or

func (e *Event) ArgUInt64Or(index int, def uint64) uint64

func (*Event) Args

func (e *Event) Args() []any

func (*Event) ArgsLen

func (e *Event) ArgsLen() int

func (*Event) ArgsStruct

func (e *Event) ArgsStruct(out any) error

func (*Event) Details

func (e *Event) Details() map[string]any

func (*Event) KwargBool

func (e *Event) KwargBool(key string) (bool, error)

func (*Event) KwargBoolOr

func (e *Event) KwargBoolOr(key string, def bool) bool

func (*Event) KwargBytes

func (e *Event) KwargBytes(key string) ([]byte, error)

func (*Event) KwargBytesOr

func (e *Event) KwargBytesOr(key string, def []byte) []byte

func (*Event) KwargDict

func (e *Event) KwargDict(key string) (Dict, error)

func (*Event) KwargDictOr

func (e *Event) KwargDictOr(key string, def Dict) Dict

func (*Event) KwargFloat64

func (e *Event) KwargFloat64(key string) (float64, error)

func (*Event) KwargFloat64Or

func (e *Event) KwargFloat64Or(key string, def float64) float64

func (*Event) KwargInt64

func (e *Event) KwargInt64(key string) (int64, error)

func (*Event) KwargInt64Or

func (e *Event) KwargInt64Or(key string, def int64) int64

func (*Event) KwargList

func (e *Event) KwargList(key string) (List, error)

func (*Event) KwargListOr

func (e *Event) KwargListOr(key string, def List) List

func (*Event) KwargString

func (e *Event) KwargString(key string) (string, error)

func (*Event) KwargStringOr

func (e *Event) KwargStringOr(key string, def string) string

func (*Event) KwargUInt64

func (e *Event) KwargUInt64(key string) (uint64, error)

func (*Event) KwargUInt64Or

func (e *Event) KwargUInt64Or(key string, def uint64) uint64

func (*Event) Kwargs

func (e *Event) Kwargs() map[string]any

func (*Event) KwargsLen

func (e *Event) KwargsLen() int

func (*Event) KwargsStruct

func (e *Event) KwargsStruct(out any) error

func (*Event) Publisher

func (e *Event) Publisher() uint64

func (*Event) PublisherAuthID

func (e *Event) PublisherAuthID() string

func (*Event) PublisherAuthRole

func (e *Event) PublisherAuthRole() string

func (*Event) Topic

func (e *Event) Topic() string

type EventHandler

type EventHandler func(event *Event)

type GoodBye

type GoodBye struct {
	Details map[string]any
	Reason  string
}

type Invocation

type Invocation struct {
	SendProgress SendProgress
	// contains filtered or unexported fields
}

func NewInvocation

func NewInvocation(args []any, kwargs map[string]any, details map[string]any) *Invocation

func (*Invocation) ArgBool

func (inv *Invocation) ArgBool(index int) (bool, error)

func (*Invocation) ArgBoolOr

func (inv *Invocation) ArgBoolOr(index int, def bool) bool

func (*Invocation) ArgBytes

func (inv *Invocation) ArgBytes(index int) ([]byte, error)

func (*Invocation) ArgBytesOr

func (inv *Invocation) ArgBytesOr(index int, def []byte) []byte

func (*Invocation) ArgDict

func (inv *Invocation) ArgDict(index int) (Dict, error)

func (*Invocation) ArgDictOr

func (inv *Invocation) ArgDictOr(index int, def Dict) Dict

func (*Invocation) ArgFloat64

func (inv *Invocation) ArgFloat64(index int) (float64, error)

func (*Invocation) ArgFloat64Or

func (inv *Invocation) ArgFloat64Or(index int, def float64) float64

func (*Invocation) ArgInt64

func (inv *Invocation) ArgInt64(index int) (int64, error)

func (*Invocation) ArgInt64Or

func (inv *Invocation) ArgInt64Or(index int, def int64) int64

func (*Invocation) ArgList

func (inv *Invocation) ArgList(index int) (List, error)

func (*Invocation) ArgListOr

func (inv *Invocation) ArgListOr(index int, def List) List

func (*Invocation) ArgString

func (inv *Invocation) ArgString(index int) (string, error)

func (*Invocation) ArgStringOr

func (inv *Invocation) ArgStringOr(index int, def string) string

func (*Invocation) ArgUInt64

func (inv *Invocation) ArgUInt64(index int) (uint64, error)

func (*Invocation) ArgUInt64Or

func (inv *Invocation) ArgUInt64Or(index int, def uint64) uint64

func (*Invocation) Args

func (inv *Invocation) Args() []any

func (*Invocation) ArgsLen

func (inv *Invocation) ArgsLen() int

func (*Invocation) ArgsStruct

func (inv *Invocation) ArgsStruct(out any) error

func (*Invocation) Caller

func (inv *Invocation) Caller() uint64

func (*Invocation) CallerAuthID

func (inv *Invocation) CallerAuthID() string

func (*Invocation) CallerAuthRole

func (inv *Invocation) CallerAuthRole() string

func (*Invocation) Details

func (inv *Invocation) Details() map[string]any

func (*Invocation) KwargBool

func (inv *Invocation) KwargBool(key string) (bool, error)

func (*Invocation) KwargBoolOr

func (inv *Invocation) KwargBoolOr(key string, def bool) bool

func (*Invocation) KwargBytes

func (inv *Invocation) KwargBytes(key string) ([]byte, error)

func (*Invocation) KwargBytesOr

func (inv *Invocation) KwargBytesOr(key string, def []byte) []byte

func (*Invocation) KwargDict

func (inv *Invocation) KwargDict(key string) (Dict, error)

func (*Invocation) KwargDictOr

func (inv *Invocation) KwargDictOr(key string, def Dict) Dict

func (*Invocation) KwargFloat64

func (inv *Invocation) KwargFloat64(key string) (float64, error)

func (*Invocation) KwargFloat64Or

func (inv *Invocation) KwargFloat64Or(key string, def float64) float64

func (*Invocation) KwargInt64

func (inv *Invocation) KwargInt64(key string) (int64, error)

func (*Invocation) KwargInt64Or

func (inv *Invocation) KwargInt64Or(key string, def int64) int64

func (*Invocation) KwargList

func (inv *Invocation) KwargList(key string) (List, error)

func (*Invocation) KwargListOr

func (inv *Invocation) KwargListOr(key string, def List) List

func (*Invocation) KwargString

func (inv *Invocation) KwargString(key string) (string, error)

func (*Invocation) KwargStringOr

func (inv *Invocation) KwargStringOr(key string, def string) string

func (*Invocation) KwargUInt64

func (inv *Invocation) KwargUInt64(key string) (uint64, error)

func (*Invocation) KwargUInt64Or

func (inv *Invocation) KwargUInt64Or(key string, def uint64) uint64

func (*Invocation) Kwargs

func (inv *Invocation) Kwargs() map[string]any

func (*Invocation) KwargsLen

func (inv *Invocation) KwargsLen() int

func (*Invocation) KwargsStruct

func (inv *Invocation) KwargsStruct(out any) error

func (*Invocation) Procedure

func (inv *Invocation) Procedure() string

func (*Invocation) Progress

func (inv *Invocation) Progress() bool

type InvocationHandler

type InvocationHandler func(ctx context.Context, invocation *Invocation) *InvocationResult

type InvocationResult

type InvocationResult struct {
	Args    []any
	Kwargs  map[string]any
	Details map[string]any
	Err     string
}

func NewInvocationError

func NewInvocationError(uri string, args ...any) *InvocationResult

func NewInvocationResult

func NewInvocationResult(args ...any) *InvocationResult

type List

type List []Value

func NewList

func NewList(values []any) List

func (List) Bool

func (l List) Bool(i int) (bool, error)

func (List) BoolOr

func (l List) BoolOr(i int, def bool) bool

func (List) Bytes

func (l List) Bytes(i int) ([]byte, error)

func (List) BytesOr

func (l List) BytesOr(i int, def []byte) []byte

func (List) Decode

func (l List) Decode(out any) error

func (List) Dict

func (l List) Dict(i int) (Dict, error)

func (List) DictOr

func (l List) DictOr(i int, def Dict) Dict

func (List) Float64

func (l List) Float64(i int) (float64, error)

func (List) Float64Or

func (l List) Float64Or(i int, def float64) float64

func (List) Get

func (l List) Get(i int) (Value, error)

func (List) GetOr

func (l List) GetOr(i int, def any) Value

func (List) Int64

func (l List) Int64(i int) (int64, error)

func (List) Int64Or

func (l List) Int64Or(i int, def int64) int64

func (List) Len

func (l List) Len() int

func (List) List

func (l List) List(i int) (List, error)

func (List) ListOr

func (l List) ListOr(i int, def List) List

func (List) Raw

func (l List) Raw() []any

func (List) String

func (l List) String(i int) (string, error)

func (List) StringOr

func (l List) StringOr(i int, def string) string

func (List) UInt64

func (l List) UInt64(i int) (uint64, error)

func (List) UInt64Or

func (l List) UInt64Or(i int, def uint64) uint64

type Listener

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

func NewListener

func NewListener(closer io.Closer, addr net.Addr) *Listener

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Port

func (l *Listener) Port() int

type ListenerType

type ListenerType int
const (
	ListenerWebSocket ListenerType = iota
	ListenerRawSocket
	ListenerUniversalTCP

	ServerOutQueueSizeDefault = 8
)

type LogLevel

type LogLevel log.Level

type Network

type Network string
const (
	NetworkUnix Network = "unix"
	NetworkTCP  Network = "tcp"
)

type Peer

type Peer interface {
	Type() TransportType
	NetConn() net.Conn
	Read() ([]byte, error)
	Write([]byte) error
	TryWrite([]byte) (bool, error)
	Close() error
}

func DialRawSocket

func DialRawSocket(ctx context.Context, url *netURL.URL, config *RawSocketDialerConfig) (Peer, error)

func DialWebSocket

func DialWebSocket(ctx context.Context, url *netURL.URL, config *WSDialerConfig) (Peer, string, error)

func NewRawSocketPeer

func NewRawSocketPeer(conn net.Conn, peerConfig RawSocketPeerConfig) Peer

func NewWebSocketPeer

func NewWebSocketPeer(conn net.Conn, peerConfig WSPeerConfig) (Peer, error)

func UpgradeRawSocket

func UpgradeRawSocket(conn net.Conn, config *RawSocketServerConfig) (Peer, transports.Serializer, error)

func UpgradeWebSocket

func UpgradeWebSocket(conn net.Conn, config *WebSocketServerConfig) (Peer, error)

type Permission

type Permission struct {
	URI            string
	MatchPolicy    string
	AllowCall      bool
	AllowPublish   bool
	AllowRegister  bool
	AllowSubscribe bool
}

func (Permission) Allows

func (p Permission) Allows(msgType uint64) bool

func (Permission) MatchURI

func (p Permission) MatchURI(uri string) bool

type Progress

type Progress struct {
	Args    []any
	Kwargs  map[string]any
	Options map[string]any
	Err     error
}

func NewFinalProgress

func NewFinalProgress(args ...any) *Progress

func NewProgress

func NewProgress(args ...any) *Progress

type ProgressReceiver

type ProgressReceiver func(result *ProgressResult)

type ProgressResult

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

func (*ProgressResult) ArgBool

func (p *ProgressResult) ArgBool(index int) (bool, error)

func (*ProgressResult) ArgBoolOr

func (p *ProgressResult) ArgBoolOr(index int, def bool) bool

func (*ProgressResult) ArgBytes

func (p *ProgressResult) ArgBytes(index int) ([]byte, error)

func (*ProgressResult) ArgBytesOr

func (p *ProgressResult) ArgBytesOr(index int, def []byte) []byte

func (*ProgressResult) ArgDict

func (p *ProgressResult) ArgDict(index int) (Dict, error)

func (*ProgressResult) ArgDictOr

func (p *ProgressResult) ArgDictOr(index int, def Dict) Dict

func (*ProgressResult) ArgFloat64

func (p *ProgressResult) ArgFloat64(index int) (float64, error)

func (*ProgressResult) ArgFloat64Or

func (p *ProgressResult) ArgFloat64Or(index int, def float64) float64

func (*ProgressResult) ArgInt64

func (p *ProgressResult) ArgInt64(index int) (int64, error)

func (*ProgressResult) ArgInt64Or

func (p *ProgressResult) ArgInt64Or(index int, def int64) int64

func (*ProgressResult) ArgList

func (p *ProgressResult) ArgList(index int) (List, error)

func (*ProgressResult) ArgListOr

func (p *ProgressResult) ArgListOr(index int, def List) List

func (*ProgressResult) ArgString

func (p *ProgressResult) ArgString(index int) (string, error)

func (*ProgressResult) ArgStringOr

func (p *ProgressResult) ArgStringOr(index int, def string) string

func (*ProgressResult) ArgUInt64

func (p *ProgressResult) ArgUInt64(index int) (uint64, error)

func (*ProgressResult) ArgUInt64Or

func (p *ProgressResult) ArgUInt64Or(index int, def uint64) uint64

func (*ProgressResult) Args

func (p *ProgressResult) Args() []any

func (*ProgressResult) ArgsLen

func (p *ProgressResult) ArgsLen() int

func (*ProgressResult) ArgsStruct

func (p *ProgressResult) ArgsStruct(out any) error

func (*ProgressResult) Details

func (p *ProgressResult) Details() map[string]any

func (*ProgressResult) KwargBool

func (p *ProgressResult) KwargBool(key string) (bool, error)

func (*ProgressResult) KwargBoolOr

func (p *ProgressResult) KwargBoolOr(key string, def bool) bool

func (*ProgressResult) KwargBytes

func (p *ProgressResult) KwargBytes(key string) ([]byte, error)

func (*ProgressResult) KwargBytesOr

func (p *ProgressResult) KwargBytesOr(key string, def []byte) []byte

func (*ProgressResult) KwargDict

func (p *ProgressResult) KwargDict(key string) (Dict, error)

func (*ProgressResult) KwargDictOr

func (p *ProgressResult) KwargDictOr(key string, def Dict) Dict

func (*ProgressResult) KwargFloat64

func (p *ProgressResult) KwargFloat64(key string) (float64, error)

func (*ProgressResult) KwargFloat64Or

func (p *ProgressResult) KwargFloat64Or(key string, def float64) float64

func (*ProgressResult) KwargInt64

func (p *ProgressResult) KwargInt64(key string) (int64, error)

func (*ProgressResult) KwargInt64Or

func (p *ProgressResult) KwargInt64Or(key string, def int64) int64

func (*ProgressResult) KwargList

func (p *ProgressResult) KwargList(key string) (List, error)

func (*ProgressResult) KwargListOr

func (p *ProgressResult) KwargListOr(key string, def List) List

func (*ProgressResult) KwargString

func (p *ProgressResult) KwargString(key string) (string, error)

func (*ProgressResult) KwargStringOr

func (p *ProgressResult) KwargStringOr(key string, def string) string

func (*ProgressResult) KwargUInt64

func (p *ProgressResult) KwargUInt64(key string) (uint64, error)

func (*ProgressResult) KwargUInt64Or

func (p *ProgressResult) KwargUInt64Or(key string, def uint64) uint64

func (*ProgressResult) Kwargs

func (p *ProgressResult) Kwargs() map[string]any

func (*ProgressResult) KwargsLen

func (p *ProgressResult) KwargsLen() int

func (*ProgressResult) KwargsStruct

func (p *ProgressResult) KwargsStruct(out any) error

type ProgressSender

type ProgressSender func(ctx context.Context) *Progress

type PublishRequest

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

func (*PublishRequest) Acknowledge

func (p *PublishRequest) Acknowledge(value bool) *PublishRequest

func (*PublishRequest) Arg

func (p *PublishRequest) Arg(arg any) *PublishRequest

func (*PublishRequest) Args

func (p *PublishRequest) Args(args ...any) *PublishRequest

func (*PublishRequest) Do

func (*PublishRequest) ExcludeMe

func (p *PublishRequest) ExcludeMe(value bool) *PublishRequest

func (*PublishRequest) Kwarg

func (p *PublishRequest) Kwarg(key string, value any) *PublishRequest

func (*PublishRequest) Kwargs

func (p *PublishRequest) Kwargs(kwArgs map[string]any) *PublishRequest

func (*PublishRequest) Option

func (p *PublishRequest) Option(key string, value any) *PublishRequest

func (*PublishRequest) Options

func (p *PublishRequest) Options(options map[string]any) *PublishRequest

func (*PublishRequest) ToPublish

func (p *PublishRequest) ToPublish(requestID uint64) *messages.Publish

type PublishResponse

type PublishResponse struct {
	Err error
}

type RawSocketAcceptor

type RawSocketAcceptor struct {
	Authenticator auth.ServerAuthenticator
	// contains filtered or unexported fields
}

func (*RawSocketAcceptor) Accept

func (r *RawSocketAcceptor) Accept(conn net.Conn, config *RawSocketServerConfig) (BaseSession, error)

func (*RawSocketAcceptor) RegisterSpec

func (r *RawSocketAcceptor) RegisterSpec(spec SerializerSpec) error

func (*RawSocketAcceptor) Spec

func (r *RawSocketAcceptor) Spec(serializerID SerializerID) (serializers.Serializer, error)

type RawSocketDialerConfig

type RawSocketDialerConfig struct {
	Serializer        transports.Serializer
	NetDial           func(ctx context.Context, network, addr string) (net.Conn, error)
	DialTimeout       time.Duration
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

type RawSocketJoiner

type RawSocketJoiner struct {
	SerializerSpec SerializerSpec
	Authenticator  auth.ClientAuthenticator
}

func (*RawSocketJoiner) Join

func (r *RawSocketJoiner) Join(ctx context.Context, uri, realm string,
	config *RawSocketDialerConfig) (BaseSession, error)

type RawSocketPeer

type RawSocketPeer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*RawSocketPeer) Close

func (r *RawSocketPeer) Close() error

func (*RawSocketPeer) NetConn

func (r *RawSocketPeer) NetConn() net.Conn

func (*RawSocketPeer) Read

func (r *RawSocketPeer) Read() ([]byte, error)

func (*RawSocketPeer) TryWrite

func (r *RawSocketPeer) TryWrite(data []byte) (bool, error)

func (*RawSocketPeer) Type

func (r *RawSocketPeer) Type() TransportType

func (*RawSocketPeer) Write

func (r *RawSocketPeer) Write(data []byte) error

type RawSocketPeerConfig

type RawSocketPeerConfig struct {
	Serializer        transports.Serializer
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

type RawSocketServerConfig

type RawSocketServerConfig struct {
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

func DefaultRawSocketServerConfig

func DefaultRawSocketServerConfig() *RawSocketServerConfig

type ReaderFunc

type ReaderFunc func(rw io.ReadWriter) ([]byte, error)

type Realm

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

func NewRealm

func NewRealm() *Realm

func (*Realm) AddRole

func (r *Realm) AddRole(role RealmRole) error

func (*Realm) AttachClient

func (r *Realm) AttachClient(base BaseSession) error

func (*Realm) AutoDiscloseCaller

func (r *Realm) AutoDiscloseCaller(disclose bool)

func (*Realm) AutoDisclosePublisher

func (r *Realm) AutoDisclosePublisher(disclose bool)

func (*Realm) Close

func (r *Realm) Close()

func (*Realm) DetachClient

func (r *Realm) DetachClient(base BaseSession) error

func (*Realm) HasRole

func (r *Realm) HasRole(role string) bool

func (*Realm) ReceiveMessage

func (r *Realm) ReceiveMessage(baseSession BaseSession, msg messages.Message) error

func (*Realm) RemoveRole

func (r *Realm) RemoveRole(role string) error

func (*Realm) SetAuthorizer

func (r *Realm) SetAuthorizer(authorizer Authorizer)

type RealmConfig

type RealmConfig struct {
	AutoDiscloseCaller    bool
	AutoDisclosePublisher bool
	Meta                  bool
	Authorizer            Authorizer
	Roles                 []RealmRole
}

func DefaultRealmConfig

func DefaultRealmConfig() *RealmConfig

type RealmRole

type RealmRole struct {
	Name        string
	Permissions []Permission
}

type RegisterRequest

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

func (*RegisterRequest) Do

func (*RegisterRequest) Invoke

func (r *RegisterRequest) Invoke(value string) *RegisterRequest

func (*RegisterRequest) Match

func (r *RegisterRequest) Match(value string) *RegisterRequest

func (*RegisterRequest) Option

func (r *RegisterRequest) Option(key string, value any) *RegisterRequest

func (*RegisterRequest) Options

func (r *RegisterRequest) Options(options map[string]any) *RegisterRequest

func (*RegisterRequest) ToRegister

func (r *RegisterRequest) ToRegister(requestID uint64) *messages.Register

type RegisterResponse

type RegisterResponse struct {
	Err error
	// contains filtered or unexported fields
}

func (RegisterResponse) Unregister

func (r RegisterResponse) Unregister() error

type Registration

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

type Router

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

func NewRouter

func NewRouter(cfg *RouterConfig) (*Router, error)

func (*Router) AddRealm

func (r *Router) AddRealm(name string, cfg *RealmConfig) error

func (*Router) AddRealmAlias

func (r *Router) AddRealmAlias(realm, alias string) error

func (*Router) AddRealmRole

func (r *Router) AddRealmRole(realm string, role RealmRole) error

func (*Router) AttachClient

func (r *Router) AttachClient(base BaseSession) error

func (*Router) Close

func (r *Router) Close()

func (*Router) DetachClient

func (r *Router) DetachClient(base BaseSession) error

func (*Router) EnableMetaAPI

func (r *Router) EnableMetaAPI(realm string) error

func (*Router) HasRealm

func (r *Router) HasRealm(name string) bool

func (*Router) HasRealmRole

func (r *Router) HasRealmRole(realm string, roleName string) (bool, error)

func (*Router) ReceiveMessage

func (r *Router) ReceiveMessage(base BaseSession, msg messages.Message) error

func (*Router) RemoveRealm

func (r *Router) RemoveRealm(name string)

func (*Router) RemoveRealmRole

func (r *Router) RemoveRealmRole(realm string, roleName string) error

func (*Router) SetRealmAuthorizer

func (r *Router) SetRealmAuthorizer(realm string, authorizer Authorizer) error

type RouterConfig

type RouterConfig struct {
	Management bool
	LogLevel   LogLevel
}

func DefaultRouterConfig

func DefaultRouterConfig() *RouterConfig

type SendProgress

type SendProgress func(args []any, kwargs map[string]any) error

type Serializer

type Serializer serializers.Serializer

type SerializerID

type SerializerID transports.Serializer
const (
	JsonSerializerID    SerializerID = 1
	MsgPackSerializerID SerializerID = 2
	CborSerializerID    SerializerID = 3
)

type SerializerSpec

type SerializerSpec interface {
	SubProtocol() string
	Serializer() serializers.Serializer
	SerializerID() SerializerID
}

func NewSerializerSpec

func NewSerializerSpec(subProtocol string, serializer serializers.Serializer,
	serializerID SerializerID) SerializerSpec

type Server

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

func NewServer

func NewServer(router *Router, authenticator auth.ServerAuthenticator, config *ServerConfig) *Server

func (*Server) HandleClient

func (s *Server) HandleClient(conn net.Conn, listener ListenerType)

func (*Server) ListenAndServeRawSocket

func (s *Server) ListenAndServeRawSocket(network Network, address string) (*Listener, error)

func (*Server) ListenAndServeUniversal

func (s *Server) ListenAndServeUniversal(network Network, address string) (*Listener, error)

func (*Server) ListenAndServeWebSocket

func (s *Server) ListenAndServeWebSocket(network Network, address string) (*Listener, error)

func (*Server) RegisterSpec

func (s *Server) RegisterSpec(spec SerializerSpec) error

func (*Server) Serve

func (s *Server) Serve(listener net.Listener, protocol ListenerType) *Listener

type ServerConfig

type ServerConfig struct {
	Throttle          *Throttle
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

type Session

type Session struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func ConnectAnonymous

func ConnectAnonymous(ctx context.Context, uri, realm string) (*Session, error)

func ConnectCRA

func ConnectCRA(ctx context.Context, uri, realm, authid, secret string) (*Session, error)

func ConnectCryptosign

func ConnectCryptosign(ctx context.Context, uri, realm, authid, privateKey string) (*Session, error)

func ConnectInMemory

func ConnectInMemory(router *Router, realm string) (*Session, error)

func ConnectTicket

func ConnectTicket(ctx context.Context, uri, realm, authid, ticket string) (*Session, error)

func NewSession

func NewSession(base BaseSession, serializer serializers.Serializer) *Session

func (*Session) Call

func (s *Session) Call(procedure string) *CallRequest

func (*Session) Connected

func (s *Session) Connected() bool

func (*Session) Details

func (s *Session) Details() *SessionDetails

func (*Session) Done

func (s *Session) Done() <-chan struct{}

func (*Session) GoodBye

func (s *Session) GoodBye() *GoodBye

func (*Session) ID

func (s *Session) ID() uint64

func (*Session) Leave

func (s *Session) Leave() error

func (*Session) Publish

func (s *Session) Publish(topic string) *PublishRequest

func (*Session) Register

func (s *Session) Register(procedure string, handler InvocationHandler) *RegisterRequest

func (*Session) SetOnLeaveListener

func (s *Session) SetOnLeaveListener(listener func())

func (*Session) Subscribe

func (s *Session) Subscribe(topic string, handler EventHandler) *SubscribeRequest

type SessionDetails

type SessionDetails = wampproto.SessionDetails

func NewSessionDetails

func NewSessionDetails(
	id uint64, realm, authID, authRole, authMethod string, authExtra map[string]any) *SessionDetails

type Strategy

type Strategy int
const (
	Burst Strategy = iota // Process all requests instantly up to the limit
	LeakyBucket
)

type SubscribeRequest

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

func (*SubscribeRequest) Do

func (*SubscribeRequest) Match

func (r *SubscribeRequest) Match(value string) *SubscribeRequest

func (*SubscribeRequest) Option

func (r *SubscribeRequest) Option(key string, value any) *SubscribeRequest

func (*SubscribeRequest) Options

func (r *SubscribeRequest) Options(options map[string]any) *SubscribeRequest

func (*SubscribeRequest) ToSubscribe

func (r *SubscribeRequest) ToSubscribe(requestID uint64) *messages.Subscribe

type SubscribeResponse

type SubscribeResponse struct {
	Err error
	// contains filtered or unexported fields
}

func (SubscribeResponse) Unsubscribe

func (r SubscribeResponse) Unsubscribe() error

type Subscription

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

type Throttle

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

func NewThrottle

func NewThrottle(rate uint, duration time.Duration, strategy Strategy) *Throttle

func (*Throttle) Create

func (t *Throttle) Create() *ratelimit.Limiter

type TransportType

type TransportType int
const (
	TransportNone TransportType = iota
	TransportWebSocket
	TransportRawSocket
	TransportInMemory
)

type UnregisterResponse

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

type UnsubscribeResponse

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

type Value

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

func NewValue

func NewValue(v any) Value

func (Value) Bool

func (v Value) Bool() (bool, error)

func (Value) BoolOr

func (v Value) BoolOr(def bool) bool

func (Value) Bytes

func (v Value) Bytes() ([]byte, error)

func (Value) BytesOr

func (v Value) BytesOr(def []byte) []byte

func (Value) Decode

func (v Value) Decode(out any) error

func (Value) Dict

func (v Value) Dict() (Dict, error)

func (Value) DictOr

func (v Value) DictOr(def Dict) Dict

func (Value) Float64

func (v Value) Float64() (float64, error)

func (Value) Float64Or

func (v Value) Float64Or(def float64) float64

func (Value) Int64

func (v Value) Int64() (int64, error)

func (Value) Int64Or

func (v Value) Int64Or(def int64) int64

func (Value) List

func (v Value) List() (List, error)

func (Value) ListOr

func (v Value) ListOr(def List) List

func (Value) Raw

func (v Value) Raw() any

func (Value) String

func (v Value) String() (string, error)

func (Value) StringOr

func (v Value) StringOr(def string) string

func (Value) UInt64

func (v Value) UInt64() (uint64, error)

func (Value) UInt64Or

func (v Value) UInt64Or(def uint64) uint64

type WSDialerConfig

type WSDialerConfig struct {
	SubProtocols      []string
	DialTimeout       time.Duration
	NetDial           func(ctx context.Context, network, addr string) (net.Conn, error)
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

type WSPeerConfig

type WSPeerConfig struct {
	Protocol          string
	Binary            bool
	Server            bool
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

type WebSocketAcceptor

type WebSocketAcceptor struct {
	Authenticator auth.ServerAuthenticator
	// contains filtered or unexported fields
}

func (*WebSocketAcceptor) Accept

func (w *WebSocketAcceptor) Accept(conn net.Conn, router *Router, config *WebSocketServerConfig) (BaseSession, error)

func (*WebSocketAcceptor) RegisterSpec

func (w *WebSocketAcceptor) RegisterSpec(spec SerializerSpec) error

func (*WebSocketAcceptor) Spec

func (w *WebSocketAcceptor) Spec(subProtocol string) (serializers.Serializer, error)

func (*WebSocketAcceptor) UpgradeAndReadHello

type WebSocketJoiner

type WebSocketJoiner struct {
	SerializerSpec SerializerSpec
	Authenticator  auth.ClientAuthenticator
}

func (*WebSocketJoiner) Join

func (w *WebSocketJoiner) Join(ctx context.Context, url, realm string, config *WSDialerConfig) (BaseSession, error)

type WebSocketPeer

type WebSocketPeer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*WebSocketPeer) Close

func (c *WebSocketPeer) Close() error

func (*WebSocketPeer) NetConn

func (c *WebSocketPeer) NetConn() net.Conn

func (*WebSocketPeer) Protocol

func (c *WebSocketPeer) Protocol() string

func (*WebSocketPeer) Read

func (c *WebSocketPeer) Read() ([]byte, error)

func (*WebSocketPeer) TryWrite

func (c *WebSocketPeer) TryWrite(data []byte) (bool, error)

func (*WebSocketPeer) Type

func (c *WebSocketPeer) Type() TransportType

func (*WebSocketPeer) Write

func (c *WebSocketPeer) Write(bytes []byte) error

type WebSocketServerConfig

type WebSocketServerConfig struct {
	SubProtocols      []string
	KeepAliveInterval time.Duration
	KeepAliveTimeout  time.Duration
	OutQueueSize      int
}

func DefaultWebSocketServerConfig

func DefaultWebSocketServerConfig() *WebSocketServerConfig

type WriterFunc

type WriterFunc func(w io.Writer, p []byte) error

Jump to

Keyboard shortcuts

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