Skip to content

refactor(liveupdates): use WebSocketPool over websocketpp - #6308

Merged
pajlada merged 14 commits into
Chatterino:masterfrom
Nerixyz:refactor/live-ws
Nov 8, 2025
Merged

pajlada merged 14 commits into
Chatterino:masterfrom
Nerixyz:refactor/live-ws

Conversation

@Nerixyz

@Nerixyz Nerixyz commented Jun 29, 2025

Copy link
Copy Markdown
Contributor

The big goal is to get rid of websocketpp in the future and use Boost.Beast exclusively.

This PR moves the live-updates (BTTV and 7TV) to use the WebSocketPool initially added for plugins. This mixes up the design of the live-updates manager and client a bit.

  • Messages are now handled in the client. In my opinion, that's where they should've been handled in the beginning as well (but websocketpp doesn't think so). Connection close/open events are handled on the manager. The latter events are handled on the GUI thread (I could also add a lock there, not sure). Messages are still delivered on the websocket thread.
  • The manager is now a QObject to be able to guard QTimers (for reconnect backoff and heartbeats on 7TV).
  • Removed virtual inheritance over CRTP - the rationale here is that the manager and client are instantiated once per "type" (BTTV/7TV), so there's no need for virtual here.

This is a draft because I added onOpen which I want to add separately.

Comment thread tests/src/BasicPubSub.cpp

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread tests/src/BasicPubSub.cpp Outdated
Comment thread tests/src/BasicPubSub.cpp Outdated
Comment thread tests/src/BttvLiveUpdates.cpp Outdated
Comment thread tests/src/SeventvEventAPI.cpp Outdated
Comment thread tests/src/SeventvEventAPI.cpp Outdated
Comment thread tests/src/SeventvEventAPI.cpp Outdated
@pajlada

pajlada commented Jun 30, 2025

Copy link
Copy Markdown
Member

At a quick glance this looks nice. I will take a more proper look when onOpen is moved to a separate PR & this PR is no longer a draft.
Thank you!

@Nerixyz
Nerixyz marked this pull request as ready for review October 7, 2025 17:34
Comment thread CHANGELOG.md
Comment thread src/providers/seventv/SeventvEventAPI.hpp

@pajlada pajlada left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shortName_ is currently unused - you can forward it to the pool for use in thread name if you'd like, no requirement for this PR

Comment thread src/providers/bttv/BttvLiveUpdates.hpp

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/common/websockets/detail/WebSocketPoolImpl.cpp
Comment thread src/common/websockets/detail/WebSocketPoolImpl.hpp
@pajlada
pajlada enabled auto-merge (squash) November 8, 2025 12:09
@pajlada
pajlada merged commit 7f393e2 into Chatterino:master Nov 8, 2025
18 checks passed
babicekmarek pushed a commit to babicekmarek/streamally-chatterino that referenced this pull request Sep 14, 2026
…no#6308)

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants