Skip to content

Refactoring of websocket package#347

Merged
lorenzodonini merged 9 commits intomasterfrom
ws/refactoring
Mar 1, 2025
Merged

Refactoring of websocket package#347
lorenzodonini merged 9 commits intomasterfrom
ws/refactoring

Conversation

@lorenzodonini
Copy link
Owner

@lorenzodonini lorenzodonini commented Feb 22, 2025

Proposed changes

Refactors the package to improve code structure, abstracting away some functionality and also allow for new features to be added on top more easily.

Included changes:

  • webSocket now includes most of the actual communication logic, including:
    • read/write pump
    • pingPong logic
    • connection configuration
  • Server and Client logic was split into server.go and client.go
    • both rely on the same webSocket struct for actual communication, streamlining the channel logic and removing some duplicate code
    • renamed the top-level interfaces
  • Added support for bi-directional PingPong (can be initiated on both client and server)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

lorenzodonini and others added 6 commits February 2, 2025 16:59
- move single channel logic to webSocket struct
- split client and server into separate files
- add a utility optTicker
- add support for bidirectional ping pong

Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
@lorenzodonini lorenzodonini changed the title Draft: Refactoring of websocket package Refactoring of websocket package Mar 1, 2025
@lorenzodonini lorenzodonini merged commit 1884a51 into master Mar 1, 2025
1 check passed
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