sessionstore

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: GPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PublicKeyBytes []byte

PublicKeyBytes holds PEM RSA Key

Functions

func Delete

func Delete(APIKey string)

Delete removes session by the APIKey provided from store

func DeleteAllConnections added in v0.0.24

func DeleteAllConnections()

DeleteAllConnections deletes all connections from all sessions

func DeleteAllForUser

func DeleteAllForUser(userID string)

DeleteAllForUser removes all sessions for user from store

func Init

func Init()

Init is the entrypoint of sessionstore

func OnSessionDelete

func OnSessionDelete(handler func(*Session))

OnSessionDelete registers callback that will called when session deleted

func OnSessionUpdate

func OnSessionUpdate(handler func(*Session))

OnSessionUpdate registers callback that will called when session updated

Types

type Conn

type Conn struct {
	ConnID        string                 `json:"connId"`
	Subscriptions map[string]interface{} `json:"subscriptions"`
}

Conn represents WAMP connection in session

type Session

type Session struct {
	APIKey      string      `json:"apiKey"`
	AccessToken string      `json:"access_token,omitempty"`
	UserID      interface{} `json:"userId"`
	Connections []*Conn     `json:"connections"`
	LastRequest time.Time   `json:"lastRequest"`
	TTL         time.Time   `json:"ttl"`
	V           int         `json:"__v"`
	sync.RWMutex
}

Session represents user session in Blank

func GetAll

func GetAll() []*Session

GetAll returns all stored sessions

func GetByAPIKey added in v0.0.15

func GetByAPIKey(APIKey string) (s *Session, err error)

GetByAPIKey returns point to Session or error if it is not exists.

func GetByUserID

func GetByUserID(id interface{}) (s *Session, err error)

GetByUserID returns point to Session or error if it is not exists.

func New

func New(user map[string]interface{}, sessionID string) *Session

New created new user session.

func (*Session) AddSubscription

func (s *Session) AddSubscription(connID, uri string, extra interface{})

AddSubscription adds subscription URI with provided params to user session

func (*Session) Delete

func (s *Session) Delete()

Delete removes Session from store

func (*Session) DeleteConnection

func (s *Session) DeleteConnection(connID string)

DeleteConnection deletes WAMP connection from user session

func (*Session) DeleteSubscription

func (s *Session) DeleteSubscription(connID, uri string)

DeleteSubscription deletes subscription from connection of user session

func (*Session) GetAPIKey

func (s *Session) GetAPIKey() string

GetAPIKey returns apiKey of session

func (*Session) GetUserID

func (s *Session) GetUserID() interface{}

GetUserID returns userID stored in session

func (*Session) Save

func (s *Session) Save()

Save saves session in store

Jump to

Keyboard shortcuts

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