Documentation ¶
Overview ¶
Package server provides network listeners, e.g. an HTTP (web/REST/JSON) server.
Index ¶
- func CreateJWT(username string, ttl int, secret string) (string, error)
- func GenerateId(size int) string
- func GetSid(req *http.Request) string
- func GetSidHdr(hdr http.Header) (sid string)
- func ParseJWT(tk, secret string) (jwt.Claims, error)
- func Route(ctx *b.Context, spec m.Map, hdlr RqHandler, req *http.Request, ...)
- func SetSid(rsp http.ResponseWriter, sid string)
- func SetSidHdr(hdr http.Header, sid string)
- type RqActionHandler
- type RqHandler
- type ServerState
- type Session
- type Sessions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateId ¶ added in v0.1.19
Generate a (hopefully) unique cryptographically secure identifier. The size parameter is specified in 4-byte (= 32-bit) units, so `generateId(2) returns a 64-bit Id. The returned Id is a URL-safe base64-encoded string.
func SetSid ¶ added in v0.1.9
func SetSid(rsp http.ResponseWriter, sid string)
Types ¶
type RqActionHandler ¶
type RqActionHandler = func(*b.Context, m.Map, *b.Message, *http.Request, http.ResponseWriter, *Session)
func GetActionHandler ¶
type ServerState ¶ added in v0.1.8
func (*ServerState) GetSession ¶ added in v0.1.19
func (st *ServerState) GetSession(sid string) b.Session
type Session ¶ added in v0.1.8
type Session struct { SessionId string Timestamp int64 // check lifetime/clean-up - when? Data m.Map // metadata, e.g. about user, ... // contains filtered or unexported fields }
func (*Session) GetMailbox ¶ added in v0.1.19
legacy/deprecated, use `GetRMailbox()` instead
func (*Session) GetRMailbox ¶ added in v0.1.19
Return a mailbox for this request. Make sure to release unused mailboxes when finished using: `defer s.ReleaseMailbox(mb, <del>)`
func (*Session) ReleaseMailbox ¶ added in v0.1.19
func (s *Session) ReleaseMailbox(mb *mbInfo)
Click to show internal directories.
Click to hide internal directories.