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

Make websocket support configurable #266

Merged
merged 2 commits into from
May 27, 2024
Merged

Make websocket support configurable #266

merged 2 commits into from
May 27, 2024

Conversation

devbugging
Copy link
Contributor

@devbugging devbugging commented May 27, 2024

Description

Enable configuration of WebSocket server. By default, it's disabled and can be enabled using --ws-enabled flag.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

Summary by CodeRabbit

  • New Features

    • Introduced a new flag --ws-enabled to enable WebSocket support in the application configuration.
  • Documentation

    • Updated README to include information about the new --ws-enabled flag.

@devbugging devbugging self-assigned this May 27, 2024
Copy link
Contributor

coderabbitai bot commented May 27, 2024

Warning

Rate Limit Exceeded

@sideninja has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 32 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between f95a202 and e625c48.

Walkthrough

The recent changes introduce a new feature to enable WebSocket support in the application via a --ws-enabled flag. The Config struct has been updated to include a WSEnabled field, and the startServer function now conditionally enables WebSocket support based on this configuration.

Changes

Files Change Summary
README.md Added documentation for the new --ws-enabled flag to enable WebSocket support.
bootstrap/bootstrap.go Introduced a conditional check to enable WebSocket support if cfg.WSEnabled is true.
config/config.go Added a WSEnabled field to the Config struct and updated FromFlags to parse the --ws-enabled flag.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Config
    participant Server

    User->>Config: Start application with --ws-enabled flag
    Config->>Server: Pass configuration with WSEnabled=true
    Server->>Server: Check if cfg.WSEnabled
    alt WSEnabled is true
        Server->>Server: Enable WebSocket support
    else WSEnabled is false
        Server->>Server: Start without WebSocket support
    end
Loading

Poem

In code we trust, new flags we bring,
WebSockets now can spread their wings.
A simple check, a config tweak,
Our server's now more strong, not weak.
With --ws-enabled, webs will spin,
A future bright, let changes begin!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to full the review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 51f7ca4 and f95a202.
Files selected for processing (3)
  • README.md (1 hunks)
  • bootstrap/bootstrap.go (1 hunks)
  • config/config.go (2 hunks)
Additional Context Used
LanguageTool (11)
README.md (11)

Near line 6: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...aging with any other EVM blockchain.** EVM Gateway implements the Ethereum JSON-RP...
Rule ID: ENGLISH_WORD_REPEAT_BEGINNING_RULE


Near line 7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ....io/execution-apis/api-documentation/). EVM Gateway is specifically designed to int...
Rule ID: ENGLISH_WORD_REPEAT_BEGINNING_RULE


Near line 7: Consider adding a comma here.
Context: ...in the underlying implementation details please refer to the [FLIP #243](https://github...
Rule ID: PLEASE_COMMA


Near line 9: Possible missing comma found.
Context: ... majority of standard Ethereum JSON-RPC APIs allowing seamless integration with exis...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA


Near line 19: Possible missing article found.
Context: ... What happens behind the scenes is that EVM gateway will receive an EVM transaction...
Rule ID: AI_HYDRA_LEO_MISSING_THE


Near line 20: When you use ‘all the …’ with a countable noun, use the plural “APIs”.
Context: ...t API component that implements all the API according to the JSON RPC API specifica...
Rule ID: LACK_OF_PLURAL_ALL_THE_NN_NNS


Near line 33: Consider a shorter alternative to avoid wordiness.
Context: ...### Running Locally Start Emulator In order to run the gateway locally you need to sta...
Rule ID: IN_ORDER_TO_PREMIUM


Near line 51: ‘in the meantime’ might be wordy. Consider a shorter alternative.
Context: ...r is run before and transactions happen in the meantime, the gateway will not fetch those histo...
Rule ID: EN_WORDINESS_PREMIUM_IN_THE_MEANTIME


Near line 54: It appears that a comma is missing.
Context: .... This will be improved soon. _In this example we use coa-address value set to servi...
Rule ID: DURING_THAT_TIME_COMMA


Near line 56: To make your writing flow more naturally, try moving ‘also’ before the verb.
Context: ...ocal running beside collecting fees. We provide also the coa-resource-create to auto-crea...
Rule ID: ALSO_PLACEMENT


Near line 57: Consider a shorter alternative to avoid wordiness.
Context: ...needed on start-up on the coa account in order to operate gateway. gas-price is set at...
Rule ID: IN_ORDER_TO_PREMIUM

Markdownlint (82)
README.md (82)

11: Expected: h2; Actual: h3
Heading levels should only increment by one level at a time


31: Expected: h2; Actual: h3
Heading levels should only increment by one level at a time


26: Expected: dash; Actual: asterisk
Unordered list style


159: Expected: dash; Actual: asterisk
Unordered list style


160: Expected: dash; Actual: asterisk
Unordered list style


161: Expected: dash; Actual: asterisk
Unordered list style


162: Expected: dash; Actual: asterisk
Unordered list style


163: Expected: dash; Actual: asterisk
Unordered list style


164: Expected: dash; Actual: asterisk
Unordered list style


165: Expected: dash; Actual: asterisk
Unordered list style


166: Expected: dash; Actual: asterisk
Unordered list style


167: Expected: dash; Actual: asterisk
Unordered list style


168: Expected: dash; Actual: asterisk
Unordered list style


169: Expected: dash; Actual: asterisk
Unordered list style


170: Expected: dash; Actual: asterisk
Unordered list style


171: Expected: dash; Actual: asterisk
Unordered list style


172: Expected: dash; Actual: asterisk
Unordered list style


173: Expected: dash; Actual: asterisk
Unordered list style


174: Expected: dash; Actual: asterisk
Unordered list style


175: Expected: dash; Actual: asterisk
Unordered list style


176: Expected: dash; Actual: asterisk
Unordered list style


177: Expected: dash; Actual: asterisk
Unordered list style


178: Expected: dash; Actual: asterisk
Unordered list style


179: Expected: dash; Actual: asterisk
Unordered list style


180: Expected: dash; Actual: asterisk
Unordered list style


181: Expected: dash; Actual: asterisk
Unordered list style


182: Expected: dash; Actual: asterisk
Unordered list style


183: Expected: dash; Actual: asterisk
Unordered list style


184: Expected: dash; Actual: asterisk
Unordered list style


185: Expected: dash; Actual: asterisk
Unordered list style


186: Expected: dash; Actual: asterisk
Unordered list style


187: Expected: dash; Actual: asterisk
Unordered list style


188: Expected: dash; Actual: asterisk
Unordered list style


189: Expected: dash; Actual: asterisk
Unordered list style


190: Expected: dash; Actual: asterisk
Unordered list style


191: Expected: dash; Actual: asterisk
Unordered list style


192: Expected: dash; Actual: asterisk
Unordered list style


193: Expected: dash; Actual: asterisk
Unordered list style


194: Expected: dash; Actual: asterisk
Unordered list style


195: Expected: dash; Actual: asterisk
Unordered list style


196: Expected: dash; Actual: asterisk
Unordered list style


197: Expected: dash; Actual: asterisk
Unordered list style


198: Expected: dash; Actual: asterisk
Unordered list style


199: Expected: dash; Actual: asterisk
Unordered list style


200: Expected: dash; Actual: asterisk
Unordered list style


201: Expected: dash; Actual: asterisk
Unordered list style


202: Expected: dash; Actual: asterisk
Unordered list style


203: Expected: dash; Actual: asterisk
Unordered list style


204: Expected: dash; Actual: asterisk
Unordered list style


205: Expected: dash; Actual: asterisk
Unordered list style


206: Expected: dash; Actual: asterisk
Unordered list style


207: Expected: dash; Actual: asterisk
Unordered list style


208: Expected: dash; Actual: asterisk
Unordered list style


7: Expected: 0 or 2; Actual: 1
Trailing spaces


54: Expected: 0 or 2; Actual: 1
Trailing spaces


55: Expected: 0 or 2; Actual: 1
Trailing spaces


56: Expected: 0 or 2; Actual: 1
Trailing spaces


57: Expected: 0 or 2; Actual: 1
Trailing spaces


58: Expected: 0 or 2; Actual: 1
Trailing spaces


160: Expected: 0 or 2; Actual: 1
Trailing spaces


172: Expected: 0 or 2; Actual: 1
Trailing spaces


15: Expected: 1; Actual: 2
Multiple consecutive blank lines


28: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines


31: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines


346: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines


349: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines


35: null
Fenced code blocks should be surrounded by blank lines


37: null
Fenced code blocks should be surrounded by blank lines


41: null
Fenced code blocks should be surrounded by blank lines


121: null
Fenced code blocks should be surrounded by blank lines


132: null
Bare URL used


135: null
Bare URL used


141: null
Bare URL used


144: null
Bare URL used


150: null
Bare URL used


153: null
Bare URL used


32: null
Emphasis used instead of a heading


61: null
Emphasis used instead of a heading


35: null
Fenced code blocks should have a language specified


41: null
Fenced code blocks should have a language specified


107: Expected: underscore; Actual: asterisk
Emphasis style


107: Expected: underscore; Actual: asterisk
Emphasis style

Additional comments not posted (4)
bootstrap/bootstrap.go (1)

273-276: Conditional WebSocket enabling implemented correctly.

Consider adding a log message to indicate whether WebSocket support is enabled or not, for better operational traceability.

config/config.go (2)

41-42: Addition of WSEnabled field to Config struct is correct and necessary for the feature.


89-89: Flag parsing for ws-enabled is implemented correctly.

Consider adding error handling for flag parsing to ensure robustness, especially in cases where invalid inputs might be provided.

README.md (1)

98-98: Documentation for the --ws-enabled flag is clear and informative.

Consider revising the documentation to address the static analysis hints, such as improving sentence variety and fixing minor grammatical issues for enhanced readability.

@devbugging devbugging merged commit 21a0600 into main May 27, 2024
2 checks passed
@m-Peter m-Peter deleted the gregor/ws-config branch July 29, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants