diff options
Diffstat (limited to 'plugins/broadcast/ws/plugin.go')
-rw-r--r-- | plugins/broadcast/ws/plugin.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/plugins/broadcast/ws/plugin.go b/plugins/broadcast/ws/plugin.go deleted file mode 100644 index f075864b..00000000 --- a/plugins/broadcast/ws/plugin.go +++ /dev/null @@ -1,59 +0,0 @@ -package ws - -import ( - "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/plugins/broadcast" - "github.com/spiral/roadrunner/v2/plugins/config" - "github.com/spiral/roadrunner/v2/plugins/logger" -) - -const ( - RootPluginName = "broadcast" - PluginName = "websockets" -) - -type Plugin struct { - // logger - log logger.Logger - // configurer plugin - cfg config.Configurer -} - -func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error { - const op = errors.Op("ws_plugin_init") - - // check for the configuration section existence - if !cfg.Has(RootPluginName) { - return errors.E(op, errors.Disabled, errors.Str("broadcast plugin section should exists in the configuration")) - } - - p.cfg = cfg - p.log = log - - return nil -} - -func (p *Plugin) Name() string { - return PluginName -} - -// Provides Provide a ws implementation -func (p *Plugin) Provides() []interface{} { - return []interface{}{ - p.Websocket, - } -} - -// Websocket method should provide the Subscriber implementation to the broadcast -func (p *Plugin) Websocket(storage broadcast.Storage) (broadcast.Subscriber, error) { - const op = errors.Op("websocket_subscriber_provide") - // initialize subscriber with the storage - ws, err := NewWSSubscriber(storage) - if err != nil { - return nil, errors.E(op, err) - } - - return ws, nil -} - -func (p *Plugin) Available() {} |