예제 #1
0
// AddHandlers adds handlers of collaboration
func AddHandlers(m *mux.Mux, mgoCache *cache.MongoCache) {
	httpRateLimiter := helper.NewDefaultRateLimiter()

	cs := &CacheStore{
		MongoCache: mgoCache,
	}

	m.AddHandler(
		handler.Request{
			Handler:   cs.Ping,
			Name:      "collaboration-ping",
			Type:      handler.PostRequest,
			Endpoint:  "/collaboration/ping",
			Ratelimit: httpRateLimiter,
		},
	)

	m.AddHandler(
		handler.Request{
			Handler:  cs.End,
			Name:     "collaboration-end",
			Type:     handler.PostRequest,
			Endpoint: "/collaboration/end",
		},
	)
}
예제 #2
0
// AddHandlers added the internal handlers to the given Muxer
func AddHandlers(m *mux.Mux) {
	httpRateLimiter := helper.NewDefaultRateLimiter()

	m.AddHandler(
		handler.Request{
			Handler:   Ping,
			Name:      "presence-ping",
			Type:      handler.GetRequest,
			Endpoint:  presence.EndpointPresencePing,
			Ratelimit: httpRateLimiter,
		},
	)
	m.AddHandler(
		handler.Request{
			Handler:   ListMembers,
			Name:      "presence-listmembers",
			Type:      handler.GetRequest,
			Endpoint:  presence.EndpointPresenceListMembers,
			Ratelimit: httpRateLimiter,
		},
	)
	m.AddHandler(
		handler.Request{
			Handler:   HandlePrivatePing,
			Name:      "presence-ping-private",
			Type:      handler.PostRequest,
			Endpoint:  presence.EndpointPresencePingPrivate,
			Ratelimit: httpRateLimiter,
		},
	)
}