Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoginHandle ¶
func LoginHandle(w http.ResponseWriter, r *http.Request)
LoginHandle is the handle to /login, LoginHandle checks for token cookies, and check validity If no tokens are provided, LoginHandle takes a form encoded user and password, and logs in, setting the token cookie to the users session token
func SignupHandle ¶
func SignupHandle(w http.ResponseWriter, r *http.Request)
SignupHandle handles /signup, takes a form encoded username and password, checks the database for an existing user, and sets the session token cookie, and redirects to the chat
func WebsocketHandlerMock ¶
func WebsocketHandlerMock(w http.ResponseWriter, r *http.Request)
WebsocketHandlerMock is handle to /websocketmock, WebsocketHandlerMock fakes a chat server, clients should use this if they wish to test their client, WebsocketHandlerMock does not check cookies and assumes the user is test
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
Broadcast is a pool of UserConn why would like to send and recieve broadcast
func (*Broadcast) Broadcast ¶
func (b *Broadcast) Broadcast(v interface{})
Broadcast sends a struct to each UserConn in the broadcast pool
type UserConn ¶
type UserConn struct { Username string Token string Connection websocket.Conn Send chan interface{} }
UserConn is a websocket connection of a chat user