Documentation
¶
Index ¶
- Variables
- func GetUser(key string, user string) (names []string)
- func InitDB()
- type Admin
- type Connection
- type CookieData
- type CookieDetail
- type File
- type FileChunks
- type Hub
- type JoinRequest
- type Joined
- type Message
- type NewRoomRequest
- type Room
- type RoomsJoined
- type Subscription
- type User
- type WSMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var HubConstruct = Hub{ Broadcast: make(chan WSMessage), Register: make(chan Subscription), UnRegister: make(chan Subscription), Users: make(map[string]map[*Connection]bool), }
View Source
var Upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
Functions ¶
Types ¶
type Connection ¶
Connection is an middleman between the websocket connection and the hub.
type CookieDetail ¶
type CookieDetail struct {
Email string
Collection string
CookieName string
Path string
Data CookieData
}
func (*CookieDetail) CheckCookie ¶
func (b *CookieDetail) CheckCookie(r *http.Request, w http.ResponseWriter) error
func (CookieDetail) CreateCookie ¶
func (b CookieDetail) CreateCookie(w http.ResponseWriter) error
type File ¶
type File struct {
MsgType string `bson:"-" json:"msgType,omitempty"`
UniqueFileHash string `bson:"_id" json:"fileHash"`
FileName string `bson:"fileName" json:"fileName"`
User string `bson:"userID" json:"userID"`
FileSize string `bson:"fileSize" json:"fileSize"`
FileType string `bson:"fileType" json:"fileType"`
Chunks int `bson:"chunks,omitempty" json:"chunks"`
}
File save files making sure they are distinct.
type FileChunks ¶
type FileChunks struct {
MsgType string `bson:"-" json:"msgType,omitempty"`
FileName string `bson:"-" json:"fileName,omitempty"`
UniqueFileHash string `bson:"_id" json:"fileHash,omitempty"`
CompressedFileHash string `bson:"compressedFileHash" json:"compressedFileHash,omitempty"`
FileBinary string `bson:"fileChunk" json:"fileChunk,omitempty"`
ChunkIndex int `bson:"chunkIndex" json:"chunkIndex"`
}
type Hub ¶
type Hub struct {
// Registered connections.
Users map[string]map[*Connection]bool
// Inbound messages from the connections.
Broadcast chan WSMessage
// Register requests from the connections.
Register chan Subscription
// Unregister requests from connections.
UnRegister chan Subscription
}
Hub maintains the set of active connections and broadcasts messages to the connections.
type JoinRequest ¶
type JoinRequest struct {
RoomID string `bson:"_id" json:"roomID"`
RoomName string `bson:"roomName" json:"roomName"`
RequestingUserName string `bson:"requestingUserName" json:"requestingUserName"`
RequestingUserID string `bson:"requestingUserID" json:"requestingUserID"`
Users []string `bson:"-" json:"users"`
}
type Message ¶
type Message struct {
RoomID string `bson:"-" json:"roomID,omitempty"`
Message string `bson:"message" json:"message,omitempty"`
FileSize string `bson:"fileSize,omitempty" json:"fileSize,omitempty"`
FileHash string `bson:"fileHash,omitempty" json:"fileHash,omitempty"`
UserID string `bson:"userID" json:"userID,omitempty"`
Name string `bson:"name" json:"name,omitempty"`
Index int `bson:"index" json:"index,omitempty"`
Time string `bson:"time" json:"time,omitempty"`
Type string `bson:"type" json:"type,omitempty"`
MessageType string `bson:"-" json:"msgType,omitempty"`
}
type NewRoomRequest ¶
type RoomsJoined ¶
type Subscription ¶
type Subscription struct {
Conn *Connection
User string
}
func (Subscription) ReadPump ¶
func (s Subscription) ReadPump(user string)
ReadPump pumps messages from the websocket connection to the hub.
func (*Subscription) WritePump ¶
func (s *Subscription) WritePump()
WritePump pumps messages from the hub to the websocket connection.
type User ¶
type User struct {
Email string `bson:"_id" json:"email"`
Name string `bson:"name" json:"name"`
DOB string `bson:"age" json:"age"`
Class string `bson:"class" json:"class"`
// ID should either be users matric or leading email stripping @....
ID string `bson:"userID" json:"userID"`
ParentEmail string `bson:"parentEmail" json:"parentEmail"`
ParentNumber string `bson:"parentNumber" json:"parentNumber"`
Password []byte `bson:"password" json:"password"`
Faculty string `bson:"faculty" json:"faculty"`
UUID string `bson:"loginUUID" json:"uuid"`
RoomsJoined []RoomsJoined `bson:"roomsJoined" json:"roomsJoined"`
JoinRequest []JoinRequest `bson:"joinRequest" json:"joinRequest"`
}
func (User) CreateUserLogin ¶
func (b User) CreateUserLogin(password string, w http.ResponseWriter) error
Click to show internal directories.
Click to hide internal directories.