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

Web Socket Support #1868

Closed
martinyonatann opened this issue Aug 11, 2024 · 2 comments
Closed

Web Socket Support #1868

martinyonatann opened this issue Aug 11, 2024 · 2 comments

Comments

@martinyonatann
Copy link

Is your feature request related to a problem? Please describe.
Yes, the problem relates to the inability to fully document and interact with WebSocket endpoints within Swaggo-generated Swagger documentation. While Swaggo is excellent for documenting and testing standard RESTful APIs, it currently lacks native support for WebSocket protocol interactions. This creates a challenge when trying to document WebSocket endpoints, as Swagger UI cannot initiate a WebSocket connection or correctly display its behavior.

Describe the solution you'd like
I would like Swaggo to support WebSocket documentation more explicitly. This could include:

  1. Native WebSocket Support: A way to declare endpoints as WebSocket connections in the Swagger documentation. This might involve using specific tags or parameters that indicate the endpoint upgrades the HTTP connection to a WebSocket.
  2. Interactive Testing: Although Swagger UI is primarily for HTTP, it would be beneficial to integrate or link to tools that can establish WebSocket connections directly from the documentation interface, allowing developers to test WebSocket endpoints as easily as they do HTTP endpoints.
  3. Clear Documentation Examples: Provide out-of-the-box templates or examples for documenting WebSocket endpoints, including details like required headers, authentication, and sample connection upgrades.

Describe alternatives you've considered
Currently, the alternative involves documenting WebSocket endpoints in Swagger as if they were standard HTTP GET or POST requests, then adding descriptive notes in the documentation to instruct users on how to manually upgrade the connection to a WebSocket. Another alternative is to use third-party tools like wscat or browser-based WebSocket clients to interact with the WebSocket endpoints, but this lacks integration with the Swaggo/Swagger ecosystem.

Additional context
WebSocket support is crucial for applications that rely on real-time communication, such as chat applications, live notifications, or real-time data feeds. Integrating this into Swaggo would greatly enhance its utility for developers working on these types of projects. Additionally, the growing popularity of WebSockets in modern web applications makes this feature increasingly relevant.

@martinyonatann martinyonatann changed the title Web Socket Documentation Web Socket Support Aug 11, 2024
@iiiusky
Copy link

iiiusky commented Aug 16, 2024

Any progress?

@XiXiangFiles
Copy link

I think this is related to an OpenAPI Spec issue. You can refer to: OpenAPI Specification. This tool generates OpenAPI documentation, so maybe you can point out where the OpenAPI spec supports WebSocket. That would be a good suggestion.

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

No branches or pull requests

3 participants