Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Access] Implement SubscriptionHandler interface and CreateSubscriptionHandler factory #6584

Open
Tracked by #6163
Guitarheroua opened this issue Oct 22, 2024 · 0 comments
Assignees
Labels

Comments

@Guitarheroua
Copy link
Collaborator

Guitarheroua commented Oct 22, 2024

SubscriptionHandler Implementation

Based on the Draft design of new WebSockets, a new SubscriptionHandler interface should be implemented as part of the new WebSocket subscription system, building on the current WebSocketController. All requirements and relationships between components are described in the draft design document.

The SubscriptionHandler interface abstracts the actual subscriptions managed by the WebSocketBroker. Concrete SubscriptionHandler implementations will be created during the WebSocketBroker::subscribe call, depending on the topic provided by the client. For example, the topic events will have an EventsSubscriptionHandler implementation to manage event subscriptions.

The supported topics include:

  • events
  • account_statuses
  • blocks
  • block_headers
  • block_digests
  • transaction_statuses

All concrete handlers will be implemented in separate tasks, based on this interface.

This issue includes implementing the interface and a factory method:

type SubscriptionHandler interface {
    Close() error
}

func CreateSubscriptionHandler(topic string, arguments map[string]interface{}, broadcastMessage func([]byte) error) (SubscriptionHandler, error)

If possible, a basic implementation of the SubscriptionHandler interface should be provided, which will include common functionality for each concrete handler. This can be done after some of the handlers have already been implemented.

@Guitarheroua Guitarheroua changed the title [Access] Implement SubscriptionHandler interface [Access] Implement SubscriptionHandler interface Oct 22, 2024
@Guitarheroua Guitarheroua changed the title [Access] Implement SubscriptionHandler interface [Access] Implement SubscriptionHandler interface and CreateSubscriptionHandler factory method Oct 23, 2024
@Guitarheroua Guitarheroua self-assigned this Oct 24, 2024
@Guitarheroua Guitarheroua changed the title [Access] Implement SubscriptionHandler interface and CreateSubscriptionHandler factory method [Access] Implement SubscriptionHandler interface and CreateSubscriptionHandler factory Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant