wamp

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package wamp defines all message types, data types, and reserved URI values defined by the WAMP specification.

Index

Constants

View Source
const (
	// Message option keywords.
	OptAcknowledge     = "acknowledge"
	OptDiscloseCaller  = "disclose_caller"
	OptDiscloseMe      = "disclose_me"
	OptError           = "error"
	OptExcludeMe       = "exclude_me"
	OptInvoke          = "invoke"
	OptMatch           = "match"
	OptMode            = "mode"
	OptProgress        = "progress"
	OptReceiveProgress = "receive_progress"
	OptTimeout         = "timeout"

	// Values for URI matching mode.
	MatchExact    = "exact"
	MatchPrefix   = "prefix"
	MatchWildcard = "wildcard"

	// Values for call cancel mode.
	CancelModeKill       = "kill"
	CancelModeKillNoWait = "killnowait"
	CancelModeSkip       = "skip"

	// Values for call invocation policy.
	InvokeSingle     = "single"
	InvokeRoundRobin = "roundrobin"
	InvokeRandom     = "random"
	InvokeFirst      = "first"
	InvokeLast       = "last"

	// Options for subscriber filtering.
	BlacklistKey = "exclude"
	WhitelistKey = "eligible"
)

Consts for message options and option values.

View Source
const (

	// Peer provided an incorrect URI for any URI-based attribute of WAMP
	// message, such as realm, topic or procedure.
	ErrInvalidURI = URI("wamp.error.invalid_uri")

	// A Dealer could not perform a call, since no procedure is currently
	// registered under the given URI.
	ErrNoSuchProcedure = URI("wamp.error.no_such_procedure")

	// A procedure could not be registered, since a procedure with the given
	// URI is already registered.
	ErrProcedureAlreadyExists = URI("wamp.error.procedure_already_exists")

	// A Dealer could not perform an unregister, since the given registration
	// is not active.
	ErrNoSuchRegistration = URI("wamp.error.no_such_registration")

	// A Broker could not perform an unsubscribe, since the given subscription
	// is not active.
	ErrNoSuchSubscription = URI("wamp.error.no_such_subscription")

	// A call failed, since the given argument types or values are not
	// acceptable to the called procedure - in which case the Callee may throw
	// this error.  Or a Router performing payload validation checked the
	// payload (args / kwargs) of a call, call result, call error or publish,
	// and the payload did not conform - in which case the Router may throw
	// this error.
	ErrInvalidArgument = URI("wamp.error.invalid_argument")

	// The Peer is shutting down completely - used as a GOODBYE (or ABORT)
	// reason.
	ErrSystemShutdown = URI("wamp.error.system_shutdown")

	// The Peer wants to leave the realm - used as a GOODBYE reason.
	ErrCloseRealm = URI("wamp.error.close_realm")

	// A Peer acknowledges ending of a session - used as a GOODBYE reply
	// reason.
	ErrGoodbyeAndOut = URI("wamp.error.goodbye_and_out")

	// A join, call, register, publish or subscribe failed, since the Peer is
	// not authorized to perform the operation.
	ErrNotAuthorized = URI("wamp.error.not_authorized")

	// A Dealer or Broker could not determine if the Peer is authorized to
	// perform a join, call, register, publish or subscribe, since the
	// authorization operation itself failed.  E.g. a custom authorizer ran
	// into an error.
	ErrAuthorizationFailed = URI("wamp.error.authorization_failed")

	// Something failed with the authentication itself, that is, authentication
	// could not run to end. *
	ErrAuthenticationFailed = URI("wamp.error.authentication_failed")

	// Peer wanted to join a non-existing realm (and the Router did not allow
	// to auto-create the realm)
	ErrNoSuchRealm = URI("wamp.error.no_such_realm")

	// A Peer was to be authenticated under a Role that does not (or no longer)
	// exists on the Router.  For example, the Peer was successfully
	// authenticated, but the Role configured does not exists - hence there is
	// some misconfiguration in the Router.
	ErrNoSuchRole = URI("wamp.error.no_such_role")

	// No authentication method the peer offered is available or active. *
	ErrNoAuthMethod = URI("wamp.error.no_auth_method")

	// A Dealer or Callee canceled a call previously issued.
	ErrCanceled = URI("wamp.error.canceled")

	// A Peer requested an interaction with an option that was disallowed by
	// the Router.
	ErrOptionNotAllowed = URI("wamp.error.option_not_allowed")

	// A Dealer could not perform a call, since a procedure with the given URI
	// is registered, but Callee Black- and Whitelisting and/or Caller
	// Exclusion lead to the exclusion of (any) Callee providing the procedure.
	ErrNoEligibleCallee = URI("wamp.error.no_eligible_callee")

	// A Router rejected client request to disclose its identity.
	ErrOptionDisallowedDiscloseMe = URI("wamp.error.option_disallowed.disclose_me")

	// A Router encountered a network failure.
	ErrNetworkFailure = URI("wamp.error.network_failure")

	// A Peer received invalid WAMP protocol message.
	ErrProtocolViolation = URI("wamp.error.protocol_violation")

	// Fired when a session joins a realm on the router.
	MetaEventSessionOnJoin = URI("wamp.session.on_join")

	// Fired when a session leaves a realm on the router or is disconnected.
	MetaEventSessionOnLeave = URI("wamp.session.on_leave")

	// Obtains the number of sessions currently attached to the realm.
	MetaProcSessionCount = URI("wamp.session.count")

	// Retrieves a list of the session IDs for all sessions currently attached
	// to the realm.
	MetaProcSessionList = URI("wamp.session.list")

	// Retrieves information on a specific session.
	MetaProcSessionGet = URI("wamp.session.get")

	// No session with the given ID exists on the router.
	ErrNoSuchSession = URI("wamp.error.no_such_session")

	// Fired when a registration is created through a registration request for
	// an URI which was previously without a registration.
	MetaEventRegOnCreate = URI("wamp.registration.on_create")

	// Fired when a Callee session is added to a registration.
	MetaEventRegOnRegister = URI("wamp.registration.on_register")

	// Fired when a Callee session is removed from a registration.
	MetaEventRegOnUnregister = URI("wamp.registration.on_unregister")

	// Fired when a registration is deleted after the last Callee session
	// attached to it has been removed.
	MetaEventRegOnDelete = URI("wamp.registration.on_delete")

	// Retrieves registration IDs listed according to match policies
	MetaProcRegList = URI("wamp.registration.list")

	// Obtains the registration (if any) managing a procedure, according to
	// some match policy.
	MetaProcRegLookup = URI("wamp.registration.lookup")

	// Obtains the registration best matching a given procedure URI.
	MetaProcRegMatch = URI("wamp.registration.match")

	// Retrieves information on a particular registration.
	MetaProcRegGet = URI("wamp.registration.get")

	// Retrieves a list of session IDs for sessions currently attached to the
	// registration.
	MetaProcRegListCallees = URI("wamp.registration.list_callees")

	// Obtains the number of sessions currently attached to the registration.
	MetaProcRegCountCallees = URI("wamp.registration.count_callees")

	// Fired when a subscription is created through a subscription request for
	// a topic which was previously without subscribers.
	MetaEventSubOnCreate = URI("wamp.subscription.on_create")

	// Fired when a session is added to a subscription.
	MetaEventSubOnSubscribe = URI("wamp.subscription.on_subscribe")

	// Fired when a session is removed from a subscription.
	MetaEventSubOnUnsubscribe = URI("wamp.subscription.on_unsubscribe")

	// Fired when a subscription is deleted after the last session attached to
	// it has been removed.
	MetaEventSubOnDelete = URI("wamp.subscription.on_delete")

	// Retrieves subscription IDs listed according to match policies.
	MetaProcSubList = URI("wamp.subscription.list")

	// Obtains the subscription (if any) managing a topic, according to some
	// match policy.
	MetaProcSubLookup = URI("wamp.subscription.lookup")

	// Retrieves a list of IDs of subscriptions matching a topic URI,
	// irrespective of match policy.
	MetaProcSubMatch = URI("wamp.subscription.match")

	// Retrieves information on a particular subscription.
	MetaProcSubGet = URI("wamp.subscription.get")

	// Retrieves a list of session IDs for sessions currently attached to the
	// subscription.
	MetaProcSubListCallees = URI("wamp.subscription.list_subscribers")

	// Obtains the number of sessions currently attached to the subscription.
	MetaProcSubCountCallees = URI("wamp.subscription.count_suscribers")

	// Add a Testament which will be published on a particular topic when the
	// Session is detached or destroyed.
	MetaProcSessionAddTestament = URI("wamp.session.add_testament")

	// Remove the Testaments for that Session, either for when it is detached
	// or destroyed.
	MetaProcSessionFlushTestaments = URI("wamp.session.flush_testaments")
)

Predefined URIs

http://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#predefined-uris

Variables

This section is empty.

Functions

func AsFloat64

func AsFloat64(v interface{}) (float64, bool)

func AsInt64

func AsInt64(v interface{}) (int64, bool)

func AsString

func AsString(v interface{}) (string, bool)

func DictFlag

func DictFlag(dict Dict, path []string) (bool, error)

DictFlag returns the bool specified by the dot-separated path.

To specify the path using a dot-separated string, call like this:

DictFlag(dict, strings.Split(path, "."))

For example: "roles.subscriber.features.publisher_identification" returns the value of the publisher_identification feature. An error is returned if the value is not present or is not a boolean type.

func DictValue

func DictValue(dict Dict, path []string) (interface{}, error)

DictValue returns the value specified by the slice of path elements.

To specify the path using a dot-separated string, call like this:

DictValue(dict, strings.Split(path, "."))

For example, the path []string{"roles","callee","features","call_timeout"} returns the value of the call_timeout feature as interface{}. An error is returned if the value is not present.

func ISO8601

func ISO8601(t time.Time) string

ISO8601 returns the given time as an ISO8601 formatted string.

func IsGoodbyeAck

func IsGoodbyeAck(msg Message) bool

IsGoodbyeAck checks if the message is an ack to end of session. This is used by transports to avoid logging an error if unable to send a goodbye acknowledgment to a client, since the client may not have waited for the acknowledgment.

func NowISO8601

func NowISO8601() string

NowISO8601 returns the current time as an ISO8601 formatted string.

func OptionFlag

func OptionFlag(opts Dict, optionName string) bool

OptionString returns the boolean value of the option with the specified name. If the option is not present, false is returned.

func OptionInt64

func OptionInt64(opts Dict, optionName string) int64

OptionInt64 returns the int64 value of the option with the specified name. If the option is not present, a value of 0 is returned.

func OptionString

func OptionString(opts Dict, optionName string) string

OptionString returns the string value of the option with the specified name. If the option is not present or is not a string type, an empty string is returned.

Types

type Abort

type Abort struct {
	Details Dict
	Reason  URI
}

Sent by a Peer to abort the opening of a WAMP session. No response is expected.

[ABORT, Details|dict, Reason|uri]

func (*Abort) MessageType

func (msg *Abort) MessageType() MessageType

type Authenticate

type Authenticate struct {
	Signature string
	Extra     Dict
}

The AUTHENTICATE message is used with certain Authentication Methods. A Client having received a challenge is expected to respond by sending a signature or token.

[AUTHENTICATE, Signature|string, Extra|dict]

func (*Authenticate) MessageType

func (msg *Authenticate) MessageType() MessageType

type Call

type Call struct {
	Request     ID
	Options     Dict
	Procedure   URI
	Arguments   List `wamp:"omitempty"`
	ArgumentsKw Dict `wamp:"omitempty"`
}

When a Caller wishes to call a remote procedure, it sends a CALL message to a Dealer:

[CALL, Request|id, Options|dict, Procedure|uri] [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list] [CALL, Request|id, Options|dict, Procedure|uri, Arguments|list,

ArgumentsKw|dict]

func (*Call) MessageType

func (msg *Call) MessageType() MessageType

type Cancel

type Cancel struct {
	Request ID
	Options Dict
}

The CANCEL message is used with the Call Canceling advanced feature. A Caller can cancel an issued call actively by sending a cancel message to the Dealer.

[CANCEL, CALL.Request|id, Options|dict]

func (*Cancel) MessageType

func (msg *Cancel) MessageType() MessageType

type Challenge

type Challenge struct {
	AuthMethod string
	Extra      Dict
}

The CHALLENGE message is used with certain Authentication Methods. During authenticated session establishment, a Router sends a challenge message.

[CHALLENGE, AuthMethod|string, Extra|dict]

func (*Challenge) MessageType

func (msg *Challenge) MessageType() MessageType

type Dict

type Dict map[string]interface{}

Dict is a dictionary that maps keys to objects in a WAMP message.

func AsDict

func AsDict(v interface{}) (Dict, bool)

func DictChild

func DictChild(dict Dict, key string) Dict

Return the child dictionary for the given key, or nil if not present.

If the child is not a Dict, an attempt is made to convert it. The dict is not modified since features may be looked up cuncurrently for the same session.

func NormalizeDict

func NormalizeDict(v interface{}) Dict

NormalizeDict takes a dict and creates a new normalized dict where all map[string]xxx are converted to Dict. Values that cannot be converted, or are already the correct map type, remain the same.

This is used for initial conversion of hello details. The original dict is not mutated.

func SetOption

func SetOption(dict Dict, name string, value interface{}) Dict

SetOption sets a single option name-value pair in message options dict.

type Error

type Error struct {
	Type        MessageType
	Request     ID
	Details     Dict
	Error       URI
	Arguments   List `wamp:"omitempty"`
	ArgumentsKw Dict `wamp:"omitempty"`
}

Error reply sent by a Peer as an error response to different kinds of requests.

[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri] [ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri,

Arguments|list]

[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri,

Arguments|list, ArgumentsKw|dict]

func (*Error) MessageType

func (msg *Error) MessageType() MessageType

type Event

type Event struct {
	Subscription ID
	Publication  ID
	Details      Dict
	Arguments    List `wamp:"omitempty"`
	ArgumentsKw  Dict `wamp:"omitempty"`
}

Event dispatched by Broker to Subscribers for subscriptions the event was matching.

[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict] [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict,

PUBLISH.Arguments|list]

[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict,

PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict]

func (*Event) MessageType

func (msg *Event) MessageType() MessageType

type Goodbye

type Goodbye struct {
	Details Dict
	Reason  URI
}

Sent by a Peer to close a previously opened WAMP session. Must be echo'ed by the receiving Peer.

[GOODBYE, Details|dict, Reason|uri]

func (*Goodbye) MessageType

func (msg *Goodbye) MessageType() MessageType

type Hello

type Hello struct {
	Realm   URI
	Details Dict
}

Sent by a Client to initiate opening of a WAMP session to a Router attaching to a Realm.

[HELLO, Realm|uri, Details|dict]

func (*Hello) MessageType

func (msg *Hello) MessageType() MessageType

type ID

type ID uint64

IDs are integers between (inclusive) 0 and 2^53 (9007199254740992)

func AsID

func AsID(v interface{}) (ID, bool)

func GlobalID

func GlobalID() ID

NewID generates a random WAMP ID.

func OptionID

func OptionID(opts Dict, optionName string) ID

OptionID returns the ID value of the option with the specified name. If the option is not present, an ID 0 is returned.

type IDGen

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

ID generator for WAMP request IDs. Create with new(IDGen).

WAMP request IDs are sequential per WAMP session, starting at 1 and wrapping around at 2**53 (both value are inclusive [1, 2**53]).

The reason to choose the specific upper bound is that 2^53 is the largest integer such that this integer and all (positive) smaller integers can be represented exactly in IEEE-754 doubles. Some languages (e.g. JavaScript) use doubles as their sole number type.

See https://github.com/wamp-proto/wamp-proto/blob/master/spec/basic.md#ids

func (*IDGen) Next

func (g *IDGen) Next() ID

Next returns next ID.

type Interrupt

type Interrupt struct {
	Request ID
	Options Dict
}

The INTERRUPT message is used with the Call Canceling advanced feature. Upon receiving a cancel for a pending call, a Dealer will issue an interrupt to the Callee.

[INTERRUPT, INVOCATION.Request|id, Options|dict]

func (*Interrupt) MessageType

func (msg *Interrupt) MessageType() MessageType

type Invocation

type Invocation struct {
	Request      ID
	Registration ID
	Details      Dict
	Arguments    List `wamp:"omitempty"`
	ArgumentsKw  Dict `wamp:"omitempty"`
}

If the Dealer is able to fulfill (mediate) the call and it allows the call, it sends a INVOCATION message to the respective Callee implementing the procedure:

[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict] [INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict,

CALL.Arguments|list]

[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict,

CALL.Arguments|list, CALL.ArgumentsKw|dict]

func (*Invocation) MessageType

func (msg *Invocation) MessageType() MessageType

type List

type List []interface{}

List represents a list of items in a WAMP message.

func AsList

func AsList(v interface{}) (List, bool)

type Message

type Message interface {
	MessageType() MessageType
}

Message is a generic container for a WAMP message.

func NewMessage

func NewMessage(t MessageType) Message

NewMessage returns an empty message of the type specified.

func RecvTimeout

func RecvTimeout(p Peer, t time.Duration) (Message, error)

RecvTimeout receives a message from a peer within the specified time.

type MessageType

type MessageType int
const (
	//                           // | Pub  | Brk  | Subs | Calr | Dealr| Calee|
	//                           // | ---- | ---- | ---- | ---- | ---- | ---- |
	HELLO        MessageType = 1 // | Tx   | Rx   | Tx   | Tx   | Rx   | Tx   |
	WELCOME      MessageType = 2 // | Rx   | Tx   | Rx   | Rx   | Tx   | Rx   |
	ABORT        MessageType = 3 // | Rx   | TxRx | Rx   | Rx   | TxRx | Rx   |
	CHALLENGE    MessageType = 4 // |      |      |      |      |      |      |
	AUTHENTICATE MessageType = 5 // |      |      |      |      |      |      |
	GOODBYE      MessageType = 6 // | TxRx | TxRx | TxRx | TxRx | TxRx | TxRx |
	// HEARTBEAT    MessageType = 7 |      |      |      |      |      |      |
	ERROR MessageType = 8 //        | Rx   | Tx   | Rx   | Rx   | TxRx | TxRx |
	//                              |      |      |      |      |      |      |
	PUBLISH   MessageType = 16 //   | Tx   | Rx   |      |      |      |      |
	PUBLISHED MessageType = 17 //   | Rx   | Tx   |      |      |      |      |
	//                              |      |      |      |      |      |      |
	SUBSCRIBE    MessageType = 32 //|      | Rx   | Tx   |      |      |      |
	SUBSCRIBED   MessageType = 33 //|      | Tx   | Rx   |      |      |      |
	UNSUBSCRIBE  MessageType = 34 //|      | Rx   | Tx   |      |      |      |
	UNSUBSCRIBED MessageType = 35 //|      | Tx   | Rx   |      |      |      |
	EVENT        MessageType = 36 //|      | Tx   | Rx   |      |      |      |
	//                              |      |      |      |      |      |      |
	CALL   MessageType = 48 //      |      |      |      | Tx   | Rx   |      |
	CANCEL MessageType = 49 //      |      |      |      | Tx   | Rx   |      |
	RESULT MessageType = 50 //      |      |      |      | Rx   | Tx   |      |
	//                              |      |      |      |      |      |      |
	REGISTER     MessageType = 64 //|      |      |      |      | Rx   | Tx   |
	REGISTERED   MessageType = 65 //|      |      |      |      | Tx   | Rx   |
	UNREGISTER   MessageType = 66 //|      |      |      |      | Rx   | Tx   |
	UNREGISTERED MessageType = 67 //|      |      |      |      | Tx   | Rx   |
	INVOCATION   MessageType = 68 //|      |      |      |      | Tx   | Rx   |
	INTERRUPT    MessageType = 69 //|      |      |      |      | Tx   | Rx   |
	YIELD        MessageType = 70 //|      |      |      |      | Rx   | Tx   |
)

Message Codes and Direction

func (MessageType) String

func (mt MessageType) String() string

String returns the message type string.

type Peer

type Peer interface {
	// Sends the message to the peer.
	Send(Message) error

	// TrySend performs a non-blocking send.  Returns error if blocked.
	TrySend(Message) error

	// Closes the peer connection and and channel returned from Recv().
	Close()

	// Recv returns a channel of messages from the peer.
	Recv() <-chan Message
}

Peer is the interface implemented by endpoints communicating via WAMP.

type Publish

type Publish struct {
	Request     ID
	Options     Dict
	Topic       URI
	Arguments   List `wamp:"omitempty"`
	ArgumentsKw Dict `wamp:"omitempty"`
}

Sent by a Publisher to a Broker to publish an event.

[PUBLISH, Request|id, Options|dict, Topic|uri] [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list] [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list,

ArgumentsKw|dict]

func (*Publish) MessageType

func (msg *Publish) MessageType() MessageType

type Published

type Published struct {
	Request     ID
	Publication ID
}

Acknowledge sent by a Broker to a Publisher for acknowledged publications.

[PUBLISHED, PUBLISH.Request|id, Publication|id]

func (*Published) MessageType

func (msg *Published) MessageType() MessageType

type Register

type Register struct {
	Request   ID
	Options   Dict
	Procedure URI
}

A Callee announces the availability of an endpoint implementing a procedure with a Dealer by sending a REGISTER message:

[REGISTER, Request|id, Options|dict, Procedure|uri]

func (*Register) MessageType

func (msg *Register) MessageType() MessageType

type Registered

type Registered struct {
	Request      ID
	Registration ID
}

If the Dealer is able to fulfill and allowing the registration, it answers by sending a REGISTERED message to the Callee:

[REGISTERED, REGISTER.Request|id, Registration|id]

func (*Registered) MessageType

func (msg *Registered) MessageType() MessageType

type Result

type Result struct {
	Request     ID
	Details     Dict
	Arguments   List `wamp:"omitempty"`
	ArgumentsKw Dict `wamp:"omitempty"`
}

The Dealer will then send a RESULT message to the original Caller:

[RESULT, CALL.Request|id, Details|dict] [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list] [RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list,

YIELD.ArgumentsKw|dict]

func (*Result) MessageType

func (msg *Result) MessageType() MessageType

type Session

type Session struct {
	// Interface for communicating with connected peer.
	Peer
	// Unique session ID.
	ID ID
	// Details about session.
	Details Dict
}

Session is an active WAMP session. It associates a session ID and details with a connected Peer, which is the remote side of the session. So, if the session owned by the router, then the Peer is the connected client.

func (Session) HasFeature

func (s Session) HasFeature(role, feature string) bool

HasFeature returns true if the session has the specified feature for the specified role.

func (Session) HasRole

func (s Session) HasRole(role string) bool

HasRole returns true if the session supports the specified role.

func (Session) String

func (s Session) String() string

String returns the session ID as a string.

type Subscribe

type Subscribe struct {
	Request ID
	Options Dict
	Topic   URI
}

Subscribe request sent by a Subscriber to a Broker to subscribe to a topic.

[SUBSCRIBE, Request|id, Options|dict, Topic|uri]

func (*Subscribe) MessageType

func (msg *Subscribe) MessageType() MessageType

type Subscribed

type Subscribed struct {
	Request      ID
	Subscription ID
}

Acknowledge sent by a Broker to a Subscriber to acknowledge a subscription.

[SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]

func (*Subscribed) MessageType

func (msg *Subscribed) MessageType() MessageType

type SyncIDGen

type SyncIDGen struct {
	IDGen
	// contains filtered or unexported fields
}

SyncIDGen is a concurrent-safe IDGen. Create with new(SyncIDGen).

func (*SyncIDGen) Next

func (g *SyncIDGen) Next() ID

Next returns next ID.

type URI

type URI string

URIs are dot-separated identifiers, where each component *should* only contain letters, numbers or underscores.

See the documentation for specifics: https://github.com/wamp-proto/wamp-proto/blob/master/rfc/text/basic/bp_identifiers.md#uris-uris

func AsURI

func AsURI(v interface{}) (URI, bool)

func OptionURI

func OptionURI(opts Dict, optionName string) URI

OptionURI returns the URI value of the option with the specified name. If the option is not present, an empty URI is returned.

func (URI) PrefixMatch

func (u URI) PrefixMatch(prefix URI) bool

PrefixMatch returns true if the receiver URI matches the specified prefix.

func (URI) ValidURI

func (u URI) ValidURI(strict bool, match string) bool

ValidURI returs true if the URI complies with formatting rules determined by the strict flag and match type.

func (URI) WildcardMatch

func (u URI) WildcardMatch(wildcard URI) bool

WildcardMatch returns true if the receiver URI matches the specified wildcard pattern.

type Unregister

type Unregister struct {
	Request      ID
	Registration ID
}

When a Callee is no longer willing to provide an implementation of the registered procedure, it sends an UNREGISTER message to the Dealer:

[UNREGISTER, Request|id, REGISTERED.Registration|id]

func (*Unregister) MessageType

func (msg *Unregister) MessageType() MessageType

type Unregistered

type Unregistered struct {
	Request ID
}

Upon successful unregistration, the Dealer sends an UNREGISTERED message to the Callee:

[UNREGISTERED, UNREGISTER.Request|id]

func (*Unregistered) MessageType

func (msg *Unregistered) MessageType() MessageType

type Unsubscribe

type Unsubscribe struct {
	Request      ID
	Subscription ID
}

Unsubscribe request sent by a Subscriber to a Broker to unsubscribe a subscription.

[UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]

func (*Unsubscribe) MessageType

func (msg *Unsubscribe) MessageType() MessageType

type Unsubscribed

type Unsubscribed struct {
	Request ID
}

Acknowledge sent by a Broker to a Subscriber to acknowledge unsubscription.

[UNSUBSCRIBED, UNSUBSCRIBE.Request|id]

func (*Unsubscribed) MessageType

func (msg *Unsubscribed) MessageType() MessageType

type Welcome

type Welcome struct {
	ID      ID
	Details Dict
}

Sent by a Router to accept a Client. The WAMP session is now open.

[WELCOME, Session|id, Details|dict]

func (*Welcome) MessageType

func (msg *Welcome) MessageType() MessageType

type Yield

type Yield struct {
	Request     ID
	Options     Dict
	Arguments   List `wamp:"omitempty"`
	ArgumentsKw Dict `wamp:"omitempty"`
}

If the Callee is able to successfully process and finish the execution of the call, it answers by sending a YIELD message to the Dealer:

[YIELD, INVOCATION.Request|id, Options|dict] [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list] [YIELD, INVOCATION.Request|id, Options|dict, Arguments|list,

ArgumentsKw|dict]

func (*Yield) MessageType

func (msg *Yield) MessageType() MessageType

Directories

Path Synopsis
Package crsign provides functionality for signing challenge data in challenge-response authentication.
Package crsign provides functionality for signing challenge data in challenge-response authentication.

Jump to

Keyboard shortcuts

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