twitch-cli icon indicating copy to clipboard operation
twitch-cli copied to clipboard

EventSub Subscriptions are a child of a single WebSocket server

Open Xemdo opened this issue 1 year ago • 0 comments

What is the problem?

Subscriptions currently exist in the context of a single server, which is incorrect. They should be updated based on actions within the server, such as a client disconnecting, but should not be exclusively attached to it. See: https://github.com/twitchdev/twitch-cli/blob/main/internal/events/websocket/mock_server/server.go#L35

Instead, there should be 4 concepts in the mock WebSocket server:

  • WebSocket Server (https://github.com/twitchdev/twitch-cli/blob/main/internal/events/websocket/mock_server/server.go)
  • WebSocket Server Manager (https://github.com/twitchdev/twitch-cli/blob/main/internal/events/websocket/mock_server/manager.go)
  • EventSub Manager (currently inside of server.go)
  • Gateway, to handle HTTP entry (https://github.com/twitchdev/twitch-cli/blob/main/internal/events/websocket/mock_server/manager.go#L79)

Xemdo avatar Mar 12 '24 22:03 Xemdo