sessionstore

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2016 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(APIKey string)

Delete removes

func DeleteAllForUser

func DeleteAllForUser(userID string)

Delete removes

func Init

func Init()

Init is the entrypoint of sessionstore

func OnSessionDelete

func OnSessionDelete(handler func(*Session))

func OnSessionUpdate

func OnSessionUpdate(handler func(*Session))

func UpdateUser

func UpdateUser(userID string, user interface{})

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"`
	UserID      string      `json:"userId"`
	Connections []*Conn     `json:"connections"`
	LastRequest time.Time   `json:"lastRequest"`
	User        interface{} `json:"user"`

	sync.RWMutex
	// contains filtered or unexported fields
}

Session represents user session in Blank

func GetAll

func GetAll() []*Session

GetAll returns all stored sessions

func GetByApiKey

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 string) (s *Session, err error)

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

func New

func New(userID string, user interface{}, tmp ...bool) *Session

New created new user session. Optional bool param for creating session with 1 minute ttl

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

GetUserID returns apiKey of session

func (*Session) GetUserID

func (s *Session) GetUserID() string

GetUserID returns userID stored in session

func (*Session) Save

func (s *Session) Save(noLastRequestUpdate bool)

Save saves session in store and update LastRequest prop in it.

Jump to

Keyboard shortcuts

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