summaryrefslogtreecommitdiff
path: root/plugins/broadcast/ws/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
committerValery Piashchynski <[email protected]>2021-05-20 22:46:19 +0300
commitd2e9d8320857f5768c54843a43ad16f59d6a3e8f (patch)
treef6f46e688b6005b2b0ea10c7238e925c0b58f25a /plugins/broadcast/ws/plugin.go
parentf85172106b4723b705aa75c3c310e8cebd050a8d (diff)
- Update linters
- Implement base interfaces - Implement BST search algo for the in-memory storage Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/broadcast/ws/plugin.go')
-rw-r--r--plugins/broadcast/ws/plugin.go25
1 files changed, 6 insertions, 19 deletions
diff --git a/plugins/broadcast/ws/plugin.go b/plugins/broadcast/ws/plugin.go
index c9a97606..f075864b 100644
--- a/plugins/broadcast/ws/plugin.go
+++ b/plugins/broadcast/ws/plugin.go
@@ -8,10 +8,8 @@ import (
)
const (
- //
RootPluginName = "broadcast"
- //
- PluginName = "websockets"
+ PluginName = "websockets"
)
type Plugin struct {
@@ -21,7 +19,6 @@ type Plugin struct {
cfg config.Configurer
}
-
func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
const op = errors.Op("ws_plugin_init")
@@ -36,20 +33,11 @@ func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error {
return nil
}
-func (p *Plugin) Serve() chan error {
- errCh := make(chan error)
-
- return errCh
-}
-
-func (p *Plugin) Stop() error {
- return nil
-}
-
func (p *Plugin) Name() string {
return PluginName
}
+// Provides Provide a ws implementation
func (p *Plugin) Provides() []interface{} {
return []interface{}{
p.Websocket,
@@ -57,9 +45,10 @@ func (p *Plugin) Provides() []interface{} {
}
// Websocket method should provide the Subscriber implementation to the broadcast
-func (p *Plugin) Websocket() (broadcast.Subscriber, error) {
+func (p *Plugin) Websocket(storage broadcast.Storage) (broadcast.Subscriber, error) {
const op = errors.Op("websocket_subscriber_provide")
- ws, err := NewWSSubscriber()
+ // initialize subscriber with the storage
+ ws, err := NewWSSubscriber(storage)
if err != nil {
return nil, errors.E(op, err)
}
@@ -67,6 +56,4 @@ func (p *Plugin) Websocket() (broadcast.Subscriber, error) {
return ws, nil
}
-
-
-func (p *Plugin) Available(){}
+func (p *Plugin) Available() {}