示例#1
0
func NewServer(a *AlertManager, server *shttp.WSServer) *AlertServer {
	s := &AlertServer{
		AlertManager: a,
		WSServer:     server,
		clients:      make(map[*shttp.WSClient]*alertClient),
	}
	server.AddEventHandler(s)

	return s
}
示例#2
0
func NewServer(g *Graph, server *shttp.WSServer) *GraphServer {
	s := &GraphServer{
		Graph:    g,
		WSServer: server,
	}
	s.Graph.AddEventListener(s)
	server.AddEventHandler(s)

	return s
}