Documentation ¶
Index ¶
- func BroadcastSocketEventToAllClient(hub *Hub, payload SocketEventStruct)
- func CreateNewSocketUser(hub *Hub, connection *websocket.Conn, userId string, username, name string)
- func EmitToSpecificClient(hub *Hub, payload SocketEventStruct, userID string)
- func HandleUserDisconnectEvent(hub *Hub, client *Client)
- func HandleUserRegisterEvent(hub *Hub, client *Client)
- type Client
- type Hub
- type JoinDisconnectPayload
- type Server
- type SocketEventStruct
- type TemplateRenderer
- type UserStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastSocketEventToAllClient ¶
func BroadcastSocketEventToAllClient(hub *Hub, payload SocketEventStruct)
BroadcastSocketEventToAllClient will emit the socket events to all socket users
func CreateNewSocketUser ¶
func EmitToSpecificClient ¶
func EmitToSpecificClient(hub *Hub, payload SocketEventStruct, userID string)
EmitToSpecificClient will emit the socket event to specific socket user
func HandleUserDisconnectEvent ¶
HandleUserDisconnectEvent will handle the Disconnect event for socket users
func HandleUserRegisterEvent ¶
HandleUserRegisterEvent will handle the Join event for New socket users
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub.
type JoinDisconnectPayload ¶
type JoinDisconnectPayload struct { Users []UserStruct `json:"users"` UserID string `json:"userID"` }
JoinDisconnectPayload will have struct for payload of join disconnect
type Server ¶
type Server struct { Account accounts.Service Trello trello.Service Inbox handling.ServiceInbox Logger *log.Entry // contains filtered or unexported fields }
type SocketEventStruct ¶
type SocketEventStruct struct { EventName string `json:"eventName"` EventPayload interface{} `json:"eventPayload"` }
SocketEventStruct struct of socket events
type TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
TemplateRenderer is a custom html/template renderer for Echo framework
type UserStruct ¶
type UserStruct struct { Username string `json:"username"` UserID string `json:"userID"` Name string `json:"name"` }
UserStruct is used for sending users with socket id
Click to show internal directories.
Click to hide internal directories.