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

Add new websocket handler and skeleton for its deps #6630

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

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.08%. Comparing base (edf27b0) to head (b42d8a7).

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.23%   41.08%   -0.16%     
==========================================
  Files        2054     2022      -32     
  Lines      182364   178761    -3603     
==========================================
- Hits        75204    73439    -1765     
+ Misses     100859    99179    -1680     
+ Partials     6301     6143     -158     
Flag Coverage Δ
unittests 41.08% <46.61%> (-0.16%) ⬇️

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
dp.Close()
c.dataProviders.Remove(id)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
//TODO: return OK response to client
}

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!

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