forked from davidfowl/signalr-ports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hub.go
39 lines (31 loc) · 913 Bytes
/
hub.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package signalr
// HubInterface is a hubs interface
type HubInterface interface {
Initialize(hubContext HubContext)
OnConnected(connectionID string)
OnDisconnected(connectionID string)
}
// Hub is a base class for hubs
type Hub struct {
context HubContext
}
// Initialize initializes a hub with a HubContext
func (h *Hub) Initialize(ctx HubContext) {
h.context = ctx
}
// Clients returns the clients of this hub
func (h *Hub) Clients() HubClients {
return h.context.Clients()
}
// Groups returns the client groups of this hub
func (h *Hub) Groups() GroupManager {
return h.context.Groups()
}
// Items returns the items for this connection
func (h *Hub) Items() map[string]interface{} {
return h.context.Items()
}
// OnConnected is called when the hub is connected
func (h *Hub) OnConnected(string) {}
//OnDisconnected is called when the hub is disconnected
func (h *Hub) OnDisconnected(string) {}