Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RoomChat ¶
func RoomChat(r *Room) http.HandlerFunc
RoomChat take a room, return a HandlerFunc, responsible for send & receive websocket data for all channels
func SendMessageToTopic ¶
SendMessageToTopic send Message to NSQ topic
Types ¶
type Channel ¶
type Channel struct { ID bson.ObjectId `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` CreatedBy string `json:"created_by" bson:"created_by"` }
Channel holds information about one specific channel in the room
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a user connect to a room, one user may have many devices to chat, so it should not be the same as user
type Message ¶
type Message struct { Name string `json:"name" bson:"name"` Body string `json:"body" bson:"body"` Channel string `json:"channel" bson:"channel"` User string `json:"user" bson:"user"` Timestamp time.Time `json:"timestamp,omitempty" bson:"timestamp"` }
Message represents a single message which a client sent to a room (same meaning as a user send to a channel)
type NsqReader ¶
type NsqReader struct {
// contains filtered or unexported fields
}
NsqReader represents a NSQ channel below topic Chat
type Room ¶
type Room struct {
// contains filtered or unexported fields
}
Room represents a room to chat
type User ¶
type User struct { ID string `json:"id" bson:"_id"` Provider string `json:"provider" bson:"provider"` Email string `json:"email" bson:"email"` Name string `json:"name" bson:"name"` FirstName string `json:"first_name" bson:"first_name"` LastName string `json:"last_name" bson:"last_name"` NickName string `json:"nick_name" bson:"nick_name"` Description string `json:"description" bson:"description"` UserID string `json:"user_id" bson:"user_id"` AvatarURL string `json:"avatar_url" bson:"avatar_url"` Location string `json:"location" bson:"location"` AccessToken string `json:"access_token" bson:"access_token"` AccessTokenSecret string `json:"access_token_secret" bson:"access_token_secret"` RefreshToken string `json:"refresh_token" bson:"refresh_token"` ExpiresAt time.Time `json:"expires_at" bson:"expires_at"` CreatedAt time.Time `json:"created_at" bson:"created_at"` Active bool `json:"active" bson:"active"` }
User hold information about an user
Click to show internal directories.
Click to hide internal directories.