Documentation
¶
Index ¶
- Constants
- Variables
- func NewInMemoryPeerPair(outQueueSize int) (Peer, Peer)
- func ReadHello(peer Peer, serializer serializers.Serializer) (*messages.Hello, error)
- func ReadMessage(peer Peer, serializer serializers.Serializer) (messages.Message, error)
- func SerializersByWSSubProtocol() map[string]serializers.Serializer
- func WriteMessage(peer Peer, message messages.Message, serializer serializers.Serializer) error
- type Authorizer
- type BaseSession
- func Accept(peer Peer, hello *messages.Hello, serializer serializers.Serializer, ...) (BaseSession, error)
- func ConnectInMemoryBase(router *Router, realm, authID, authRole string, ...) (BaseSession, error)
- func Join(cl Peer, realm string, serializer serializers.Serializer, ...) (BaseSession, error)
- func NewBaseSession(id uint64, realm, authID, authRole, authMethod string, ...) BaseSession
- type CallRequest
- func (c *CallRequest) Arg(arg any) *CallRequest
- func (c *CallRequest) Args(args ...any) *CallRequest
- func (c *CallRequest) Do() CallResponse
- func (c *CallRequest) DoContext(ctx context.Context) CallResponse
- func (c *CallRequest) Kwarg(key string, value any) *CallRequest
- func (c *CallRequest) Kwargs(kwargs map[string]any) *CallRequest
- func (c *CallRequest) Option(key string, value any) *CallRequest
- func (c *CallRequest) Options(options map[string]any) *CallRequest
- func (c *CallRequest) ProgressReceiver(handler ProgressReceiver) *CallRequest
- func (c *CallRequest) ProgressSender(handler ProgressSender) *CallRequest
- type CallResponse
- func (c *CallResponse) ArgBool(index int) (bool, error)
- func (c *CallResponse) ArgBoolOr(index int, def bool) bool
- func (c *CallResponse) ArgBytes(index int) ([]byte, error)
- func (c *CallResponse) ArgBytesOr(index int, def []byte) []byte
- func (c *CallResponse) ArgDict(index int) (Dict, error)
- func (c *CallResponse) ArgDictOr(index int, def Dict) Dict
- func (c *CallResponse) ArgFloat64(index int) (float64, error)
- func (c *CallResponse) ArgFloat64Or(index int, def float64) float64
- func (c *CallResponse) ArgInt64(index int) (int64, error)
- func (c *CallResponse) ArgInt64Or(index int, def int64) int64
- func (c *CallResponse) ArgList(index int) (List, error)
- func (c *CallResponse) ArgListOr(index int, def List) List
- func (c *CallResponse) ArgString(index int) (string, error)
- func (c *CallResponse) ArgStringOr(index int, def string) string
- func (c *CallResponse) ArgUInt64(index int) (uint64, error)
- func (c *CallResponse) ArgUInt64Or(index int, def uint64) uint64
- func (c *CallResponse) Args() []any
- func (c *CallResponse) ArgsLen() int
- func (c *CallResponse) ArgsStruct(out any) error
- func (c *CallResponse) Details() map[string]any
- func (c *CallResponse) KwargBool(key string) (bool, error)
- func (c *CallResponse) KwargBoolOr(key string, def bool) bool
- func (c *CallResponse) KwargBytes(key string) ([]byte, error)
- func (c *CallResponse) KwargBytesOr(key string, def []byte) []byte
- func (c *CallResponse) KwargDict(key string) (Dict, error)
- func (c *CallResponse) KwargDictOr(key string, def Dict) Dict
- func (c *CallResponse) KwargFloat64(key string) (float64, error)
- func (c *CallResponse) KwargFloat64Or(key string, def float64) float64
- func (c *CallResponse) KwargInt64(key string) (int64, error)
- func (c *CallResponse) KwargInt64Or(key string, def int64) int64
- func (c *CallResponse) KwargListOr(key string, def List) List
- func (c *CallResponse) KwargString(key string) (string, error)
- func (c *CallResponse) KwargStringOr(key string, def string) string
- func (c *CallResponse) KwargUInt64(key string) (uint64, error)
- func (c *CallResponse) KwargUInt64Or(key string, def uint64) uint64
- func (c *CallResponse) Kwargs() map[string]any
- func (c *CallResponse) KwargsLen() int
- func (c *CallResponse) KwargsList(key string) (List, error)
- func (c *CallResponse) KwargsStruct(out any) error
- type Client
- type Dict
- func (d Dict) Bool(key string) (bool, error)
- func (d Dict) BoolOr(key string, def bool) bool
- func (d Dict) Bytes(key string) ([]byte, error)
- func (d Dict) BytesOr(key string, def []byte) []byte
- func (d Dict) Decode(out any) error
- func (d Dict) Dict(key string) (Dict, error)
- func (d Dict) DictOr(key string, def Dict) Dict
- func (d Dict) Float64(key string) (float64, error)
- func (d Dict) Float64Or(key string, def float64) float64
- func (d Dict) Get(key string) (Value, error)
- func (d Dict) GetOr(key string, def any) Value
- func (d Dict) Has(key string) bool
- func (d Dict) Int64(key string) (int64, error)
- func (d Dict) Int64Or(key string, def int64) int64
- func (d Dict) Len() int
- func (d Dict) List(key string) (List, error)
- func (d Dict) ListOr(key string, def List) List
- func (d Dict) Raw() map[string]any
- func (d Dict) String(key string) (string, error)
- func (d Dict) StringOr(key string, def string) string
- func (d Dict) UInt64(key string) (uint64, error)
- func (d Dict) UInt64Or(key string, def uint64) uint64
- type Error
- type Event
- func (e *Event) ArgBool(index int) (bool, error)
- func (e *Event) ArgBoolOr(index int, def bool) bool
- func (e *Event) ArgBytes(index int) ([]byte, error)
- func (e *Event) ArgBytesOr(index int, def []byte) []byte
- func (e *Event) ArgDict(index int) (dict Dict, err error)
- func (e *Event) ArgDictOr(index int, def Dict) Dict
- func (e *Event) ArgFloat64(index int) (float64, error)
- func (e *Event) ArgFloat64Or(index int, def float64) float64
- func (e *Event) ArgInt64(index int) (int64, error)
- func (e *Event) ArgInt64Or(index int, def int64) int64
- func (e *Event) ArgList(index int) (list List, err error)
- func (e *Event) ArgListOr(index int, def List) List
- func (e *Event) ArgString(index int) (string, error)
- func (e *Event) ArgStringOr(index int, def string) string
- func (e *Event) ArgUInt64(index int) (uint64, error)
- func (e *Event) ArgUInt64Or(index int, def uint64) uint64
- func (e *Event) Args() []any
- func (e *Event) ArgsLen() int
- func (e *Event) ArgsStruct(out any) error
- func (e *Event) Details() map[string]any
- func (e *Event) KwargBool(key string) (bool, error)
- func (e *Event) KwargBoolOr(key string, def bool) bool
- func (e *Event) KwargBytes(key string) ([]byte, error)
- func (e *Event) KwargBytesOr(key string, def []byte) []byte
- func (e *Event) KwargDict(key string) (Dict, error)
- func (e *Event) KwargDictOr(key string, def Dict) Dict
- func (e *Event) KwargFloat64(key string) (float64, error)
- func (e *Event) KwargFloat64Or(key string, def float64) float64
- func (e *Event) KwargInt64(key string) (int64, error)
- func (e *Event) KwargInt64Or(key string, def int64) int64
- func (e *Event) KwargList(key string) (List, error)
- func (e *Event) KwargListOr(key string, def List) List
- func (e *Event) KwargString(key string) (string, error)
- func (e *Event) KwargStringOr(key string, def string) string
- func (e *Event) KwargUInt64(key string) (uint64, error)
- func (e *Event) KwargUInt64Or(key string, def uint64) uint64
- func (e *Event) Kwargs() map[string]any
- func (e *Event) KwargsLen() int
- func (e *Event) KwargsStruct(out any) error
- func (e *Event) Publisher() uint64
- func (e *Event) PublisherAuthID() string
- func (e *Event) PublisherAuthRole() string
- func (e *Event) Topic() string
- type EventHandler
- type GoodBye
- type Invocation
- func (inv *Invocation) ArgBool(index int) (bool, error)
- func (inv *Invocation) ArgBoolOr(index int, def bool) bool
- func (inv *Invocation) ArgBytes(index int) ([]byte, error)
- func (inv *Invocation) ArgBytesOr(index int, def []byte) []byte
- func (inv *Invocation) ArgDict(index int) (Dict, error)
- func (inv *Invocation) ArgDictOr(index int, def Dict) Dict
- func (inv *Invocation) ArgFloat64(index int) (float64, error)
- func (inv *Invocation) ArgFloat64Or(index int, def float64) float64
- func (inv *Invocation) ArgInt64(index int) (int64, error)
- func (inv *Invocation) ArgInt64Or(index int, def int64) int64
- func (inv *Invocation) ArgList(index int) (List, error)
- func (inv *Invocation) ArgListOr(index int, def List) List
- func (inv *Invocation) ArgString(index int) (string, error)
- func (inv *Invocation) ArgStringOr(index int, def string) string
- func (inv *Invocation) ArgUInt64(index int) (uint64, error)
- func (inv *Invocation) ArgUInt64Or(index int, def uint64) uint64
- func (inv *Invocation) Args() []any
- func (inv *Invocation) ArgsLen() int
- func (inv *Invocation) ArgsStruct(out any) error
- func (inv *Invocation) Caller() uint64
- func (inv *Invocation) CallerAuthID() string
- func (inv *Invocation) CallerAuthRole() string
- func (inv *Invocation) Details() map[string]any
- func (inv *Invocation) KwargBool(key string) (bool, error)
- func (inv *Invocation) KwargBoolOr(key string, def bool) bool
- func (inv *Invocation) KwargBytes(key string) ([]byte, error)
- func (inv *Invocation) KwargBytesOr(key string, def []byte) []byte
- func (inv *Invocation) KwargDict(key string) (Dict, error)
- func (inv *Invocation) KwargDictOr(key string, def Dict) Dict
- func (inv *Invocation) KwargFloat64(key string) (float64, error)
- func (inv *Invocation) KwargFloat64Or(key string, def float64) float64
- func (inv *Invocation) KwargInt64(key string) (int64, error)
- func (inv *Invocation) KwargInt64Or(key string, def int64) int64
- func (inv *Invocation) KwargList(key string) (List, error)
- func (inv *Invocation) KwargListOr(key string, def List) List
- func (inv *Invocation) KwargString(key string) (string, error)
- func (inv *Invocation) KwargStringOr(key string, def string) string
- func (inv *Invocation) KwargUInt64(key string) (uint64, error)
- func (inv *Invocation) KwargUInt64Or(key string, def uint64) uint64
- func (inv *Invocation) Kwargs() map[string]any
- func (inv *Invocation) KwargsLen() int
- func (inv *Invocation) KwargsStruct(out any) error
- func (inv *Invocation) Procedure() string
- func (inv *Invocation) Progress() bool
- type InvocationHandler
- type InvocationResult
- type List
- func (l List) Bool(i int) (bool, error)
- func (l List) BoolOr(i int, def bool) bool
- func (l List) Bytes(i int) ([]byte, error)
- func (l List) BytesOr(i int, def []byte) []byte
- func (l List) Decode(out any) error
- func (l List) Dict(i int) (Dict, error)
- func (l List) DictOr(i int, def Dict) Dict
- func (l List) Float64(i int) (float64, error)
- func (l List) Float64Or(i int, def float64) float64
- func (l List) Get(i int) (Value, error)
- func (l List) GetOr(i int, def any) Value
- func (l List) Int64(i int) (int64, error)
- func (l List) Int64Or(i int, def int64) int64
- func (l List) Len() int
- func (l List) List(i int) (List, error)
- func (l List) ListOr(i int, def List) List
- func (l List) Raw() []any
- func (l List) String(i int) (string, error)
- func (l List) StringOr(i int, def string) string
- func (l List) UInt64(i int) (uint64, error)
- func (l List) UInt64Or(i int, def uint64) uint64
- type Listener
- type ListenerType
- type LogLevel
- type Network
- type Peer
- func DialRawSocket(ctx context.Context, url *netURL.URL, config *RawSocketDialerConfig) (Peer, error)
- func DialWebSocket(ctx context.Context, url *netURL.URL, config *WSDialerConfig) (Peer, string, error)
- func NewRawSocketPeer(conn net.Conn, peerConfig RawSocketPeerConfig) Peer
- func NewWebSocketPeer(conn net.Conn, peerConfig WSPeerConfig) (Peer, error)
- func UpgradeRawSocket(conn net.Conn, config *RawSocketServerConfig) (Peer, transports.Serializer, error)
- func UpgradeWebSocket(conn net.Conn, config *WebSocketServerConfig) (Peer, error)
- type Permission
- type Progress
- type ProgressReceiver
- type ProgressResult
- func (p *ProgressResult) ArgBool(index int) (bool, error)
- func (p *ProgressResult) ArgBoolOr(index int, def bool) bool
- func (p *ProgressResult) ArgBytes(index int) ([]byte, error)
- func (p *ProgressResult) ArgBytesOr(index int, def []byte) []byte
- func (p *ProgressResult) ArgDict(index int) (Dict, error)
- func (p *ProgressResult) ArgDictOr(index int, def Dict) Dict
- func (p *ProgressResult) ArgFloat64(index int) (float64, error)
- func (p *ProgressResult) ArgFloat64Or(index int, def float64) float64
- func (p *ProgressResult) ArgInt64(index int) (int64, error)
- func (p *ProgressResult) ArgInt64Or(index int, def int64) int64
- func (p *ProgressResult) ArgList(index int) (List, error)
- func (p *ProgressResult) ArgListOr(index int, def List) List
- func (p *ProgressResult) ArgString(index int) (string, error)
- func (p *ProgressResult) ArgStringOr(index int, def string) string
- func (p *ProgressResult) ArgUInt64(index int) (uint64, error)
- func (p *ProgressResult) ArgUInt64Or(index int, def uint64) uint64
- func (p *ProgressResult) Args() []any
- func (p *ProgressResult) ArgsLen() int
- func (p *ProgressResult) ArgsStruct(out any) error
- func (p *ProgressResult) Details() map[string]any
- func (p *ProgressResult) KwargBool(key string) (bool, error)
- func (p *ProgressResult) KwargBoolOr(key string, def bool) bool
- func (p *ProgressResult) KwargBytes(key string) ([]byte, error)
- func (p *ProgressResult) KwargBytesOr(key string, def []byte) []byte
- func (p *ProgressResult) KwargDict(key string) (Dict, error)
- func (p *ProgressResult) KwargDictOr(key string, def Dict) Dict
- func (p *ProgressResult) KwargFloat64(key string) (float64, error)
- func (p *ProgressResult) KwargFloat64Or(key string, def float64) float64
- func (p *ProgressResult) KwargInt64(key string) (int64, error)
- func (p *ProgressResult) KwargInt64Or(key string, def int64) int64
- func (p *ProgressResult) KwargList(key string) (List, error)
- func (p *ProgressResult) KwargListOr(key string, def List) List
- func (p *ProgressResult) KwargString(key string) (string, error)
- func (p *ProgressResult) KwargStringOr(key string, def string) string
- func (p *ProgressResult) KwargUInt64(key string) (uint64, error)
- func (p *ProgressResult) KwargUInt64Or(key string, def uint64) uint64
- func (p *ProgressResult) Kwargs() map[string]any
- func (p *ProgressResult) KwargsLen() int
- func (p *ProgressResult) KwargsStruct(out any) error
- type ProgressSender
- type PublishRequest
- func (p *PublishRequest) Acknowledge(value bool) *PublishRequest
- func (p *PublishRequest) Arg(arg any) *PublishRequest
- func (p *PublishRequest) Args(args ...any) *PublishRequest
- func (p *PublishRequest) Do() PublishResponse
- func (p *PublishRequest) ExcludeMe(value bool) *PublishRequest
- func (p *PublishRequest) Kwarg(key string, value any) *PublishRequest
- func (p *PublishRequest) Kwargs(kwArgs map[string]any) *PublishRequest
- func (p *PublishRequest) Option(key string, value any) *PublishRequest
- func (p *PublishRequest) Options(options map[string]any) *PublishRequest
- func (p *PublishRequest) ToPublish(requestID uint64) *messages.Publish
- type PublishResponse
- type RawSocketAcceptor
- type RawSocketDialerConfig
- type RawSocketJoiner
- type RawSocketPeer
- type RawSocketPeerConfig
- type RawSocketServerConfig
- type ReaderFunc
- type Realm
- func (r *Realm) AddRole(role RealmRole) error
- func (r *Realm) AttachClient(base BaseSession) error
- func (r *Realm) AutoDiscloseCaller(disclose bool)
- func (r *Realm) AutoDisclosePublisher(disclose bool)
- func (r *Realm) Close()
- func (r *Realm) DetachClient(base BaseSession) error
- func (r *Realm) HasRole(role string) bool
- func (r *Realm) ReceiveMessage(baseSession BaseSession, msg messages.Message) error
- func (r *Realm) RemoveRole(role string) error
- func (r *Realm) SetAuthorizer(authorizer Authorizer)
- type RealmConfig
- type RealmRole
- type RegisterRequest
- func (r *RegisterRequest) Do() RegisterResponse
- func (r *RegisterRequest) Invoke(value string) *RegisterRequest
- func (r *RegisterRequest) Match(value string) *RegisterRequest
- func (r *RegisterRequest) Option(key string, value any) *RegisterRequest
- func (r *RegisterRequest) Options(options map[string]any) *RegisterRequest
- func (r *RegisterRequest) ToRegister(requestID uint64) *messages.Register
- type RegisterResponse
- type Registration
- type Router
- func (r *Router) AddRealm(name string, cfg *RealmConfig) error
- func (r *Router) AddRealmAlias(realm, alias string) error
- func (r *Router) AddRealmRole(realm string, role RealmRole) error
- func (r *Router) AttachClient(base BaseSession) error
- func (r *Router) Close()
- func (r *Router) DetachClient(base BaseSession) error
- func (r *Router) EnableMetaAPI(realm string) error
- func (r *Router) HasRealm(name string) bool
- func (r *Router) HasRealmRole(realm string, roleName string) (bool, error)
- func (r *Router) ReceiveMessage(base BaseSession, msg messages.Message) error
- func (r *Router) RemoveRealm(name string)
- func (r *Router) RemoveRealmRole(realm string, roleName string) error
- func (r *Router) SetRealmAuthorizer(realm string, authorizer Authorizer) error
- type RouterConfig
- type SendProgress
- type Serializer
- type SerializerID
- type SerializerSpec
- type Server
- func (s *Server) HandleClient(conn net.Conn, listener ListenerType)
- func (s *Server) ListenAndServeRawSocket(network Network, address string) (*Listener, error)
- func (s *Server) ListenAndServeUniversal(network Network, address string) (*Listener, error)
- func (s *Server) ListenAndServeWebSocket(network Network, address string) (*Listener, error)
- func (s *Server) RegisterSpec(spec SerializerSpec) error
- func (s *Server) Serve(listener net.Listener, protocol ListenerType) *Listener
- type ServerConfig
- type Session
- func ConnectAnonymous(ctx context.Context, uri, realm string) (*Session, error)
- func ConnectCRA(ctx context.Context, uri, realm, authid, secret string) (*Session, error)
- func ConnectCryptosign(ctx context.Context, uri, realm, authid, privateKey string) (*Session, error)
- func ConnectInMemory(router *Router, realm string) (*Session, error)
- func ConnectTicket(ctx context.Context, uri, realm, authid, ticket string) (*Session, error)
- func NewSession(base BaseSession, serializer serializers.Serializer) *Session
- func (s *Session) Call(procedure string) *CallRequest
- func (s *Session) Connected() bool
- func (s *Session) Details() *SessionDetails
- func (s *Session) Done() <-chan struct{}
- func (s *Session) GoodBye() *GoodBye
- func (s *Session) ID() uint64
- func (s *Session) Leave() error
- func (s *Session) Publish(topic string) *PublishRequest
- func (s *Session) Register(procedure string, handler InvocationHandler) *RegisterRequest
- func (s *Session) SetOnLeaveListener(listener func())
- func (s *Session) Subscribe(topic string, handler EventHandler) *SubscribeRequest
- type SessionDetails
- type Strategy
- type SubscribeRequest
- func (r *SubscribeRequest) Do() SubscribeResponse
- func (r *SubscribeRequest) Match(value string) *SubscribeRequest
- func (r *SubscribeRequest) Option(key string, value any) *SubscribeRequest
- func (r *SubscribeRequest) Options(options map[string]any) *SubscribeRequest
- func (r *SubscribeRequest) ToSubscribe(requestID uint64) *messages.Subscribe
- type SubscribeResponse
- type Subscription
- type Throttle
- type TransportType
- type UnregisterResponse
- type UnsubscribeResponse
- type Value
- func (v Value) Bool() (bool, error)
- func (v Value) BoolOr(def bool) bool
- func (v Value) Bytes() ([]byte, error)
- func (v Value) BytesOr(def []byte) []byte
- func (v Value) Decode(out any) error
- func (v Value) Dict() (Dict, error)
- func (v Value) DictOr(def Dict) Dict
- func (v Value) Float64() (float64, error)
- func (v Value) Float64Or(def float64) float64
- func (v Value) Int64() (int64, error)
- func (v Value) Int64Or(def int64) int64
- func (v Value) List() (List, error)
- func (v Value) ListOr(def List) List
- func (v Value) Raw() any
- func (v Value) String() (string, error)
- func (v Value) StringOr(def string) string
- func (v Value) UInt64() (uint64, error)
- func (v Value) UInt64Or(def uint64) uint64
- type WSDialerConfig
- type WSPeerConfig
- type WebSocketAcceptor
- func (w *WebSocketAcceptor) Accept(conn net.Conn, router *Router, config *WebSocketServerConfig) (BaseSession, error)
- func (w *WebSocketAcceptor) RegisterSpec(spec SerializerSpec) error
- func (w *WebSocketAcceptor) Spec(subProtocol string) (serializers.Serializer, error)
- func (w *WebSocketAcceptor) UpgradeAndReadHello(conn net.Conn, config *WebSocketServerConfig) (*WebSocketPeer, *messages.Hello, serializers.Serializer, error)
- type WebSocketJoiner
- type WebSocketPeer
- func (c *WebSocketPeer) Close() error
- func (c *WebSocketPeer) NetConn() net.Conn
- func (c *WebSocketPeer) Protocol() string
- func (c *WebSocketPeer) Read() ([]byte, error)
- func (c *WebSocketPeer) TryWrite(data []byte) (bool, error)
- func (c *WebSocketPeer) Type() TransportType
- func (c *WebSocketPeer) Write(bytes []byte) error
- type WebSocketServerConfig
- type WriterFunc
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 ¶
View Source
var ( JSONSerializerSpec = NewSerializerSpec( JsonWebsocketProtocol, &serializers.JSONSerializer{}, JsonSerializerID) CBORSerializerSpec = NewSerializerSpec( CborWebsocketProtocol, &serializers.CBORSerializer{}, CborSerializerID) MsgPackSerializerSpec = NewSerializerSpec( MsgpackWebsocketProtocol, &serializers.MsgPackSerializer{}, MsgPackSerializerID) )
Functions ¶
func NewInMemoryPeerPair ¶
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) ArgBytesOr ¶
func (c *CallResponse) ArgBytesOr(index int, def []byte) []byte
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) ArgInt64Or ¶
func (c *CallResponse) ArgInt64Or(index int, def int64) int64
func (*CallResponse) ArgStringOr ¶
func (c *CallResponse) ArgStringOr(index int, def string) string
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) 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) 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 Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (*Event) ArgsStruct ¶
func (*Event) KwargsStruct ¶
func (*Event) PublisherAuthID ¶
func (*Event) PublisherAuthRole ¶
type EventHandler ¶
type EventHandler func(event *Event)
type Invocation ¶
type Invocation struct {
SendProgress SendProgress
// contains filtered or unexported fields
}
func NewInvocation ¶
func (*Invocation) ArgBytesOr ¶
func (inv *Invocation) ArgBytesOr(index int, def []byte) []byte
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) ArgInt64Or ¶
func (inv *Invocation) ArgInt64Or(index int, def int64) int64
func (*Invocation) ArgStringOr ¶
func (inv *Invocation) ArgStringOr(index int, def string) string
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) 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) 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) 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 ¶
func NewInvocationError ¶
func NewInvocationError(uri string, args ...any) *InvocationResult
func NewInvocationResult ¶
func NewInvocationResult(args ...any) *InvocationResult
type ListenerType ¶
type ListenerType int
const ( ListenerWebSocket ListenerType = iota ListenerRawSocket ListenerUniversalTCP ServerOutQueueSizeDefault = 8 )
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 DialWebSocket ¶
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 ProgressReceiver ¶
type ProgressReceiver func(result *ProgressResult)
type ProgressResult ¶
type ProgressResult struct {
// contains filtered or unexported fields
}
func (*ProgressResult) ArgBytesOr ¶
func (p *ProgressResult) ArgBytesOr(index int, def []byte) []byte
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) ArgInt64Or ¶
func (p *ProgressResult) ArgInt64Or(index int, def int64) int64
func (*ProgressResult) ArgStringOr ¶
func (p *ProgressResult) ArgStringOr(index int, def string) string
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) 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) 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) 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 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 (p *PublishRequest) Do() PublishResponse
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
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 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 ¶
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) 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 (*Realm) AttachClient ¶
func (r *Realm) AttachClient(base BaseSession) error
func (*Realm) AutoDiscloseCaller ¶
func (*Realm) AutoDisclosePublisher ¶
func (*Realm) DetachClient ¶
func (r *Realm) DetachClient(base BaseSession) error
func (*Realm) ReceiveMessage ¶
func (r *Realm) ReceiveMessage(baseSession BaseSession, msg messages.Message) error
func (*Realm) RemoveRole ¶
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 (r *RegisterRequest) Do() RegisterResponse
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) AddRealmAlias ¶
func (*Router) AttachClient ¶
func (r *Router) AttachClient(base BaseSession) error
func (*Router) DetachClient ¶
func (r *Router) DetachClient(base BaseSession) error
func (*Router) EnableMetaAPI ¶
func (*Router) HasRealmRole ¶
func (*Router) ReceiveMessage ¶
func (r *Router) ReceiveMessage(base BaseSession, msg messages.Message) error
func (*Router) RemoveRealm ¶
func (*Router) RemoveRealmRole ¶
func (*Router) SetRealmAuthorizer ¶
func (r *Router) SetRealmAuthorizer(realm string, authorizer Authorizer) error
type RouterConfig ¶
func DefaultRouterConfig ¶
func DefaultRouterConfig() *RouterConfig
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 (*Server) ListenAndServeUniversal ¶
func (*Server) ListenAndServeWebSocket ¶
func (*Server) RegisterSpec ¶
func (s *Server) RegisterSpec(spec SerializerSpec) error
type ServerConfig ¶
type Session ¶
func ConnectAnonymous ¶
func ConnectCRA ¶
func ConnectCryptosign ¶
func ConnectTicket ¶
func NewSession ¶
func NewSession(base BaseSession, serializer serializers.Serializer) *Session
func (*Session) Call ¶
func (s *Session) Call(procedure string) *CallRequest
func (*Session) Details ¶
func (s *Session) Details() *SessionDetails
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 SubscribeRequest ¶
type SubscribeRequest struct {
// contains filtered or unexported fields
}
func (*SubscribeRequest) Do ¶
func (r *SubscribeRequest) Do() SubscribeResponse
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 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 WSDialerConfig ¶
type WSPeerConfig ¶
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 ¶
func (w *WebSocketAcceptor) UpgradeAndReadHello( conn net.Conn, config *WebSocketServerConfig) (*WebSocketPeer, *messages.Hello, serializers.Serializer, error)
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 ¶
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) 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
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
nxt
command
|
|
|
handshake/callee
command
|
|
|
handshake/caller
command
|
|
|
pubsub/publisher
command
|
|
|
pubsub/subscriber
command
|
|
|
reconnect
command
|
|
|
rpc/callee
command
|
|
|
rpc/caller
command
|
|
|
rpc_progressive_results/callee
command
|
|
|
rpc_progressive_results/caller
command
|
|
|
server/authenticator
command
|
|
|
server/rawsocket
command
|
|
|
server/universaltcp
command
|
|
|
server/websocket
command
|
|
Click to show internal directories.
Click to hide internal directories.