Live: update centrifuge and the ChannelHandler api (#28843)
This commit is contained in:
@@ -12,21 +12,16 @@ type PluginHandler struct {
|
||||
}
|
||||
|
||||
// GetHandlerForPath called on init
|
||||
func (g *PluginHandler) GetHandlerForPath(path string) (models.ChannelHandler, error) {
|
||||
return g, nil // all dashboards share the same handler
|
||||
func (h *PluginHandler) GetHandlerForPath(path string) (models.ChannelHandler, error) {
|
||||
return h, nil // all dashboards share the same handler
|
||||
}
|
||||
|
||||
// GetChannelOptions called fast and often
|
||||
func (g *PluginHandler) GetChannelOptions(id string) centrifuge.ChannelOptions {
|
||||
return centrifuge.ChannelOptions{}
|
||||
// OnSubscribe for now allows anyone to subscribe
|
||||
func (h *PluginHandler) OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) (centrifuge.SubscribeReply, error) {
|
||||
return centrifuge.SubscribeReply{}, nil
|
||||
}
|
||||
|
||||
// OnSubscribe for now allows anyone to subscribe to any dashboard
|
||||
func (g *PluginHandler) OnSubscribe(c *centrifuge.Client, e centrifuge.SubscribeEvent) error {
|
||||
return nil // anyone can subscribe
|
||||
}
|
||||
|
||||
// AllowBroadcast checks if a message from the websocket can be broadcast on this channel
|
||||
func (g *PluginHandler) AllowBroadcast(c *centrifuge.Client, e centrifuge.PublishEvent) error {
|
||||
return nil // broadcast any event
|
||||
// OnPublish checks if a message from the websocket can be broadcast on this channel
|
||||
func (h *PluginHandler) OnPublish(c *centrifuge.Client, e centrifuge.PublishEvent) (centrifuge.PublishReply, error) {
|
||||
return centrifuge.PublishReply{}, nil // broadcast any event
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user