Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SocketTicket ¶
type SocketTicket struct { ID string `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"` UserID string `json:"user_id"` Expires time.Time `json:"expires"` }
SocketTicket exists because the Javascript WebSocket API doesn't allow headers to be modified. This isn't a problem on the web, as we have cookies, but on mobile we usuall send a header with an authentication token. The SocketTicket acts as a temporary authentication to allow authenticated websocket transactions.
func GetByUserID ¶
func GetByUserID(userID string, db *gorm.DB) (t SocketTicket, err error)
func NewSocketTicket ¶
func NewSocketTicket(userID string) SocketTicket
NewSocketTicket generates a new socket with a key
func (*SocketTicket) IsValid ¶
func (s *SocketTicket) IsValid() bool
IsValid returns whether a ticket is still good. They expire after 24 hours
Click to show internal directories.
Click to hide internal directories.