Skip to content

jbjordan/relay_rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relay Echo Listener and Sender in Rust

This repo contains an Echo websocket server using Azure Relay. With this example, you can start the relay listener on any machine, and start the relay sender on any machine. The relay sender will take command line input, send it to the listener over the websocket, and recieve an echo back.

Underlying websocket configuration is based on this repo: https://github.com/campbellgoe/rust_websocket_client

Instructions

  1. Update the relay namespace, entity, sas_key_name, and sas_key strings in main.rs with the values of your own Relay namespace information. Create a namespace: https://learn.microsoft.com/en-us/azure/azure-relay/relay-hybrid-connections-dotnet-get-started#create-a-namespace

  2. Running the Relay Listener First, ensure that you are in the directory of the project (rust_relay).

Then, run the listener using Cargo:

cargo run -- listener

This will compile and start the relay listener. You should see output indicating that the listener has started:

Starting Listener
Listener Connected
  1. Running the WebSocket Client Open a new terminal window or tab. Navigate to the project directory (rust_relay).

Then, run the sender using Cargo:

cargo run -- sender

This will compile and start the relay sender. You should see output indicating that the client has connected to the server:

Starting Sender
Sender Connected
Enter Text:
  1. If everything is set up correctly, you should be able to enter text and the listener will echo it back.
Starting Sender
Sender Connected
Enter text:
howdy
Echo:
howdy

Additional Notes

Review Relay documentation to ensure machine can communicate with Relay server: https://learn.microsoft.com/en-us/azure/azure-relay/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages