Пример #1
0
func (t *TopologyApi) registerEndpoints(r *shttp.Server) {
	routes := []shttp.Route{
		{
			"TopologiesIndex",
			"GET",
			"/api/topology",
			t.topologyIndex,
		},
	}

	r.RegisterRoutes(routes)
}
Пример #2
0
func NewServer(a *AlertManager, server *shttp.Server, pongWait time.Duration) *Server {
	s := &Server{
		AlertManager: a,
		wsServer: &WSServer{
			AlertManager: a,
			broadcast:    make(chan string, 500),
			quit:         make(chan bool, 1),
			register:     make(chan *WSClient),
			unregister:   make(chan *WSClient),
			clients:      make(map[*WSClient]bool),
			pongWait:     pongWait,
			pingPeriod:   (pongWait * 8) / 10,
		},
	}

	server.HandleFunc("/ws/alert", s.serveMessages)

	return s
}
Пример #3
0
func (f *FlowApi) registerEndpoints(r *shttp.Server) {
	routes := []shttp.Route{
		{
			"FlowSearch",
			"GET",
			"/api/flow/search",
			f.flowSearch,
		},
		{
			"ConversationLayer",
			"GET",
			"/api/flow/conversation/{layer}",
			f.conversationLayer,
		},
		{
			"Discovery",
			"GET",
			"/api/flow/discovery/{type}",
			f.discoveryType,
		},
	}

	r.RegisterRoutes(routes)
}