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] Add new websocket handler and skeleton for its deps #6630

Merged

Conversation

illia-malachyn
Copy link
Contributor

@illia-malachyn illia-malachyn commented Nov 8, 2024

Closes #6593 #6583 #6617
Relates to #6584

  • Added websocket controller
  • Added mock block provider
  • Added data provider factory
  • Added websocket handler
  • Added websocket config
  • Added a tiny POC test for websocket handler

* Added websocket controller
* Added mock block provider
* Added data provider factory
* Added websocket handler
* Added websocket config
* Added a tiny POC test for websocket handler
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 46.61922% with 150 lines in your changes missing coverage. Please review.

Project coverage is 41.24%. Comparing base (ed149a7) to head (c38f6ce).
Report is 84 commits behind head on master.

Files with missing lines Patch % Lines
engine/access/rest/websockets/controller.go 52.63% 56 Missing and 7 partials ⚠️
...est/websockets/data_provider/mock/data_provider.go 0.00% 35 Missing ⚠️
utils/concurrentmap/concurrent_map.go 0.00% 12 Missing ⚠️
engine/access/rest/router/router.go 0.00% 10 Missing ⚠️
engine/access/rpc/engine.go 0.00% 10 Missing ⚠️
engine/access/rest/websockets/handler.go 70.00% 7 Missing and 2 partials ⚠️
...ine/access/rest/websockets/data_provider/blocks.go 84.00% 4 Missing ⚠️
engine/access/rest/router/router_test_helpers.go 0.00% 2 Missing ⚠️
...ne/access/rest/websockets/data_provider/factory.go 83.33% 2 Missing ⚠️
cmd/observer/node_builder/observer_builder.go 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6630      +/-   ##
==========================================
+ Coverage   41.19%   41.24%   +0.04%     
==========================================
  Files        2052     2060       +8     
  Lines      182215   182635     +420     
==========================================
+ Hits        75069    75331     +262     
- Misses     100852   100994     +142     
- Partials     6294     6310      +16     
Flag Coverage Δ
unittests 41.24% <46.61%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@illia-malachyn
Copy link
Contributor Author

Speaking of tests, I see it the following way: we should write a wrap websocket connection with our custom mock and write unit tests for websocket controller (it accepts ws conn as argument). This will require some code, so a separate task should be created for this #6631

@Guitarheroua Guitarheroua self-requested a review November 8, 2024 16:18
engine/access/rest/websockets/config.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/threadsafe_map.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/models.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/data_provider/blocks.go Outdated Show resolved Hide resolved
* Use contexts as function arguments
* Move models to folder for consistency
* Change parse msg function
* Simplify mock block provider to remove dedlock
engine/access/rest/websockets/controller.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/data_provider/blocks.go Outdated Show resolved Hide resolved
engine/access/rest/websockets/controller.go Show resolved Hide resolved
engine/access/rest/websockets/controller.go Show resolved Hide resolved
engine/access/rest/websockets/handler.go Show resolved Hide resolved
utils/concurrentmap/concurrent_map.go Outdated Show resolved Hide resolved
utils/concurrentmap/concurrent_map.go Outdated Show resolved Hide resolved
utils/concurrentmap/concurrent_map.go Outdated Show resolved Hide resolved
* make handle_connection blocking
* rename concurrent_map
* use type switch instead of switch
* add todos for error handling
Copy link
Contributor

@Guitarheroua Guitarheroua left a comment

Choose a reason for hiding this comment

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

Nice! Looks good to me!

@Guitarheroua Guitarheroua changed the title Add new websocket handler and skeleton for its deps [Access] Add new websocket handler and skeleton for its deps Nov 20, 2024
engine/access/rest/websockets/handler.go Outdated Show resolved Hide resolved
@peterargue peterargue added this pull request to the merge queue Nov 21, 2024
Merged via the queue into onflow:master with commit a3676ba Nov 21, 2024
55 checks passed
@peterargue peterargue deleted the illia-malachyn/6617-new-ws-handler branch November 21, 2024 22:37
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.

[Access] Implement web socket handler for new web socket connection under /ws endpoint
5 participants