Documentation ¶
Index ¶
- Constants
- Variables
- func HandleWebsocket(t Handler) func(*websocket.Conn)
- type CallErrorMsg
- type CallMsg
- type CallResultMsg
- type Connection
- type ConnectionID
- type EventMsg
- type Handler
- type MessageType
- type PendingAuth
- type Permissions
- type PubSubPermission
- type PublishIntercept
- type PublishMsg
- type RPCError
- type RPCHandler
- type RPCPermission
- type Server
- func (t *Server) HandleWebsocket(conn *websocket.Conn)
- func (t *Server) PublishEvent(uri string, msg interface{})
- func (t *Server) RegisterRPC(uri string, f RPCHandler)
- func (t *Server) RegisterUnauthRPC(uri string, f RPCHandler)
- func (t *Server) UnregisterRPC(uri string)
- func (t *Server) UnregisterUnauthRPC(uri string)
- type SubscribeMsg
- type UnsubscribeMsg
- type WAMPError
- type WelcomeMsg
Constants ¶
View Source
const ( POSTMASTER_VERSION = "0.2.0" POSTMASTER_SERVER_ID = "postmaster-" + POSTMASTER_VERSION )
View Source
const ALLOWED_BACKLOG = 6
View Source
const PROTOCOL_VERSION = 1
View Source
const WAMP_BASE_URL = "http://api.wamp.ws/"
Auth: wamp cra
View Source
const WAMP_PROCEDURE_URL = WAMP_BASE_URL + "procedure#"
Variables ¶
View Source
var ( ErrInvalidURI = &WAMPError{"invalid URI"} ErrInvalidNumArgs = &WAMPError{"invalid number of arguments in message"} ErrUnsupportedProtocol = &WAMPError{"unsupported protocol"} )
Functions ¶
func HandleWebsocket ¶
HandleWebsocket is a Go1.0 shim for method values
Types ¶
type CallErrorMsg ¶
type CallErrorMsg struct { CallID string ErrorURI string ErrorDesc string ErrorDetails interface{} }
func (*CallErrorMsg) MarshalJSON ¶
func (msg *CallErrorMsg) MarshalJSON() ([]byte, error)
func (*CallErrorMsg) UnmarshalJSON ¶
func (msg *CallErrorMsg) UnmarshalJSON(jsonData []byte) error
type CallResultMsg ¶
type CallResultMsg struct { CallID string Result interface{} }
func (*CallResultMsg) MarshalJSON ¶
func (msg *CallResultMsg) MarshalJSON() ([]byte, error)
func (*CallResultMsg) UnmarshalJSON ¶
func (msg *CallResultMsg) UnmarshalJSON(jsonData []byte) error
type Connection ¶
type Connection struct { Username string P *Permissions //Permission for this client // contains filtered or unexported fields }
type ConnectionID ¶
type ConnectionID string
type EventMsg ¶
type EventMsg struct { TopicURI string Event interface{} }
func (*EventMsg) MarshalJSON ¶
func (*EventMsg) UnmarshalJSON ¶
type MessageType ¶
type MessageType int
const ( WELCOME MessageType = iota PREFIX CALL CALLRESULT CALLERROR SUBSCRIBE UNSUBSCRIBE PUBLISH EVENT )
type PendingAuth ¶
type PendingAuth struct {
// contains filtered or unexported fields
}
type Permissions ¶
type Permissions struct { RPC map[string]RPCPermission //maps uri to RPCPermission PubSub map[string]PubSubPermission //maps uri to PubSubPermission }
type PubSubPermission ¶
type PublishIntercept ¶
type PublishIntercept func(id *Connection, msg PublishMsg) bool
type PublishMsg ¶
type PublishMsg struct { TopicURI string Event interface{} ExcludeMe bool ExcludeList []string EligibleList []string }
func (*PublishMsg) MarshalJSON ¶
func (msg *PublishMsg) MarshalJSON() ([]byte, error)
func (*PublishMsg) UnmarshalJSON ¶
func (msg *PublishMsg) UnmarshalJSON(jsonData []byte) error
type RPCHandler ¶
type RPCHandler func(*Connection, string, ...interface{}) (interface{}, *RPCError)
type RPCPermission ¶
type RPCPermission bool
type Server ¶
type Server struct { //Get the authentication secret for an authentication key, i.e. the user password for the user name. Return "" when the authentication key does not exist. GetAuthSecret func(authKey string) (string, error) // Required //Get the permissions the session is granted when the authentication succeeds for the given key / extra information. GetAuthPermissions func(authKey string, authExtra map[string]interface{}) (Permissions, error) // Required //Fired when client authentication was successful. OnAuthenticated func(authKey string, authExtra map[string]interface{}, permission Permissions) // Optional //Message interept MessageToPublish PublishIntercept // Optional //Fired when authenticated client disconnections OnDisconnect func(authKey string, authExtra map[string]interface{}) //Optional // contains filtered or unexported fields }
Represents data storage per instance
func (*Server) HandleWebsocket ¶
Starting point of websocket connection
- Verify identity
- Register send/recieve channel
- Manage send/recieve for duration of connection
func (*Server) PublishEvent ¶
Publish event outside of normal client->client structure
func (*Server) RegisterRPC ¶
func (t *Server) RegisterRPC(uri string, f RPCHandler)
func (*Server) RegisterUnauthRPC ¶
func (t *Server) RegisterUnauthRPC(uri string, f RPCHandler)
func (*Server) UnregisterRPC ¶
func (*Server) UnregisterUnauthRPC ¶
type SubscribeMsg ¶
type SubscribeMsg struct {
TopicURI string
}
func (*SubscribeMsg) MarshalJSON ¶
func (msg *SubscribeMsg) MarshalJSON() ([]byte, error)
func (*SubscribeMsg) UnmarshalJSON ¶
func (msg *SubscribeMsg) UnmarshalJSON(jsonData []byte) error
type UnsubscribeMsg ¶
type UnsubscribeMsg struct {
TopicURI string
}
func (*UnsubscribeMsg) MarshalJSON ¶
func (msg *UnsubscribeMsg) MarshalJSON() ([]byte, error)
func (*UnsubscribeMsg) UnmarshalJSON ¶
func (msg *UnsubscribeMsg) UnmarshalJSON(jsonData []byte) error
type WelcomeMsg ¶
func (*WelcomeMsg) MarshalJSON ¶
func (msg *WelcomeMsg) MarshalJSON() ([]byte, error)
func (*WelcomeMsg) UnmarshalJSON ¶
func (msg *WelcomeMsg) UnmarshalJSON(jsonData []byte) error
Click to show internal directories.
Click to hide internal directories.