api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: GPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(session *Session, key string)

func Get

func Get(session *Session, key string)

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewRouter

func NewRouter() *mux.Router

func Save

func Save(session *Session, key string, create bool, data []byte)

func Start

func Start()

func Subscribe

func Subscribe(session *Session, key string)

func Unsubscribe

func Unsubscribe(session *Session, key string)

Types

type Route

type Route struct {
	Name    string
	Method  string
	Path    string
	Handler http.Handler
}

type Routes

type Routes []Route

type Session

type Session struct {
	database.Base
	ID string

	Expires       int64
	Subscriptions []string
	// contains filtered or unexported fields
}

Session holds data for an api session.

func GetSession

func GetSession(name string) (*Session, error)

GetSession fetches Session with the provided name from the default namespace.

func GetSessionFromNamespace

func GetSessionFromNamespace(namespace *datastore.Key, name string) (*Session, error)

GetSessionFromNamespace fetches Session with the provided name from the provided namespace.

func NewSession

func NewSession(wsConn *websocket.Conn) *Session

NewSession creates a new session.

func ResumeSession

func ResumeSession(id string, wsConn *websocket.Conn) (*Session, error)

ResumeSession an existing session.

func (*Session) Create

func (m *Session) Create(name string) error

Create saves Session with the provided name in the default namespace.

func (*Session) CreateInNamespace

func (m *Session) CreateInNamespace(namespace *datastore.Key, name string) error

CreateInNamespace saves Session with the provided name in the provided namespace.

func (*Session) CreateWithID

func (m *Session) CreateWithID() error

CreateWithID saves Session with the its ID in the default namespace.

func (*Session) Deactivate

func (m *Session) Deactivate()

Deactivate closes down a session, making it ready to be resumed.

func (*Session) Save

func (m *Session) Save() error

Save saves Session.

func (*Session) Subscribe

func (m *Session) Subscribe(subKey string)

Subscribe subscribes to a database key and saves the new subscription table if the session was already persisted.

func (*Session) Unsubscribe

func (m *Session) Unsubscribe(subKey string)

Unsubscribe unsubscribes from a database key and saves the new subscription table if the session was already persisted.

func (*Session) Writer

func (m *Session) Writer()

Writer writes messages to the client.

Jump to

Keyboard shortcuts

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