forked from davidfowl/signalr-ports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclientproxy.go
32 lines (25 loc) · 804 Bytes
/
clientproxy.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
package signalr
//ClientProxy allows the hub to send messages to one or more of its clients
type ClientProxy interface {
Send(target string, args ...interface{})
}
type allClientProxy struct {
lifetimeManager HubLifetimeManager
}
func (a *allClientProxy) Send(target string, args ...interface{}) {
a.lifetimeManager.InvokeAll(target, args)
}
type singleClientProxy struct {
connectionID string
lifetimeManager HubLifetimeManager
}
func (a *singleClientProxy) Send(target string, args ...interface{}) {
a.lifetimeManager.InvokeClient(a.connectionID, target, args)
}
type groupClientProxy struct {
groupName string
lifetimeManager HubLifetimeManager
}
func (g *groupClientProxy) Send(target string, args ...interface{}) {
g.lifetimeManager.InvokeGroup(g.groupName, target, args)
}