Skip to content

Add WebSocket connection documentation #8404

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rbren
Copy link
Collaborator

@rbren rbren commented May 9, 2025

This PR adds documentation for connecting to the OpenHands WebSocket API:

  • Adds a user guide for connecting to the WebSocket API
  • Updates the sidebar to include the new documentation

The documentation includes:

  • Connection parameters and protocol details
  • Event types and message formats
  • Code examples in JavaScript
  • Examples using websocat for testing

To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:623ca84-nikolaik   --name openhands-app-623ca84   docker.all-hands.dev/all-hands-ai/openhands:623ca84

@rbren rbren changed the title Add WebSocket API documentation with websocat examples Add WebSocket connection documentation May 9, 2025
Copy link
Collaborator Author

@rbren rbren left a comment

Choose a reason for hiding this comment

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

@OpenHands make it clear that if your connecting via OpenHands Cloud, you should provision an API key, and then pass the header Authorization: Bearer $API_KEY to websocat or whatever other websocket client

Link to https://docs.all-hands.dev/modules/usage/cloud/cloud-api for getting an API key

Also add a link to that page (inside the docs/ folder) linking to this page and explaining that this is how you connect to the websocket

@rbren rbren marked this pull request as ready for review May 11, 2025 20:30
@rbren rbren requested a review from mamoodi as a code owner May 11, 2025 20:30
@mamoodi
Copy link
Collaborator

mamoodi commented May 12, 2025

Ack on this. Is the information accurate? Have you done an initial review?

@rbren
Copy link
Collaborator Author

rbren commented May 12, 2025

I've read through it, but haven't run the code samples

@OpenHands replace the placeholder http://your-openhands-server with http://localhost:3000

Copy link

openhands-ai bot commented May 12, 2025

I'm on it! rbren can track my progress at all-hands.dev

Copy link

openhands-ai bot commented May 12, 2025

I successfully addressed the PR comment by replacing all instances of the placeholder URL in the WebSocket documentation.

Here's what I did:

  1. Located all instances of "http://your-openhands-server" and "ws://your-openhands-server" in the WebSocket documentation file (docs/modules/usage/how-to/websocket-connection.md)
  2. Replaced them with "http://localhost:3000" and "ws://localhost:3000" respectively
  3. Committed the changes with the message "Replace placeholder server URL with localhost:3000"
  4. Pushed the changes to the add-websocket-documentation branch

The PR #8404 has been updated with these changes. All code examples in the WebSocket documentation now use localhost:3000 as the server URL instead of the placeholder.

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.

3 participants