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

Document how to connect remotely #1342

Closed
emilk opened this issue Feb 17, 2023 · 5 comments · Fixed by #4834
Closed

Document how to connect remotely #1342

emilk opened this issue Feb 17, 2023 · 5 comments · Fixed by #4834
Labels
📖 documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@emilk
Copy link
Member

emilk commented Feb 17, 2023

A common use-case of Rerun is to do logging on one machine, and then viewing that log-data on another machine. This use-case is currently under-documented. It should be documented in rerun --help, in the API docs, and in our high-level docs.

How you do it

The easiest way of doing it is to use the serve() API function, and the connecting to it with either the web-viewer or the native viewer.

serve() takes a single argument controlling whether or not to also open a browser on the same machine. You probably want to pass in false here, so call serve(false).

serve(false) will start two servers:

  • One WebSocket server (default port: 9877). This is for the log-messages.
  • One HTTP server (default port: 9090), serving the web-viewer .wasm and .html.

These serves will shut-down when your logging app closes, so you may want to add a sleep at the end of your logging!

You can then connect to the WebSocket-server using rerun 127.0.0.1:9877

Example:

Run: examples/python/objectron/main.py --serve
Connect with native viewer: rerun 127.0.0.1:9877
Or use the web viewer with url http://127.0.0.1:9090/?url=ws://127.0.0.1:9877

Notes

  • serve() will store all log messages in RAM until the process terminates. There is no eviction of old data yet.
@emilk emilk added the 📖 documentation Improvements or additions to documentation label Feb 17, 2023
@emilk emilk added the good first issue Good for newcomers label Feb 28, 2023
@rossng
Copy link

rossng commented Feb 28, 2023

I'm trying out Rerun for the first time and am struggling with this exact issue. Ultimately I'd like to stream data from a client to a Rerun server on a (potentially) different machine.

I've created a new executable package which just contains this code to launch the viewer/server:

use rerun::Session;

pub fn main() -> eyre::Result<()> {
    let mut session = Session::init("arcade", true);
    session.serve(true);

    loop {}
}

And then in my application code I initialise the session and connect to the server:

let mut rerun = Session::init("arcade", true);
rerun.connect(SocketAddr::new(std::net::IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 9877));

And then later on I do some logging to Rerun:

let pos = value.origin();
let _ = MsgSender::new(format!("robot"))
    .with_component(&vec![Vec3D::new(pos.x as f32, pos.y as f32, pos.z as f32)])
    .unwrap()
    .send(&mut session);

However, this isn't working. On the send side, I get these errors:

17:17:50 [WARN] Failed to send message: Failed to send to Rerun server at [127.0.0.1:9877]: Broken pipe (os error 32)

And on the receive side:

thread 'tokio-runtime-worker' panicked at 'Failed to accept: Protocol(HttparseError(Token))', /Users/ross/.cargo/registry/src/github.com-1ecc6299db9ec823/re_ws_comms-0.2.0/src/server.rs:115:52

I couldn't find anything in the docs that covers this yet. A simple example would be a huge help!

@emilk
Copy link
Member Author

emilk commented Feb 28, 2023

Session is all about producing a log stream. Session::serve will serve logged data to a connecting viewer (on native or web).

If you want to launch a viewer, just run rerun (cargo install rerun) or create you own binary which calls rerun::run. Once you have the viewer running you can connect to it with session.connect. So basically: replace you first code-snippet with cargo install rerun && rerun.

See also: https://www.rerun.io/docs/reference/sdk-operating-modes

@emilk
Copy link
Member Author

emilk commented Jun 12, 2023

This is now documented as the primary way of using Rust in https://www.rerun.io/docs/getting-started/logging-rust and it also has a small section at the end of https://www.rerun.io/docs/getting-started/logging-python

@emilk emilk closed this as completed Jun 12, 2023
@emilk emilk reopened this Jan 15, 2024
@emilk
Copy link
Member Author

emilk commented Jan 15, 2024

I failed to find the docs for this

@emilk
Copy link
Member Author

emilk commented Jan 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants