msend
is a chat application based on Web Sockets written in Rust for the Back-End and ReactJS for the Front-End.
The main goal is to experiment with Web Sockets and the Rust programming language, taking advantage of the Tokio runtime.
In order to run this application locally Rust must be installed in your system. Its recommended to use rustup to install Rust the first time.
https://github.com/EstebanBorai/msend-server.git
cd msend-server
RUST_LOG=info cargo run
A warp server will listen on ws://127.0.0.1:8080/
.
You must complete all steps on Development section in order to follow the steps on this section.
With the server running, on ws://127.0.0.1:8080/
, a WebSocket connection must be established from the client side.
Open your favorite browser, then open the developer tools (usually by pressing F12), and write the following to the console.
// create a WebSocket connection using the WebSocket object
const msend = new WebSocket('ws://127.0.0.1:8080');
// send a message
msend.send(JSON.stringify({
type: 'post',
payload: {
body: 'Hello from msend!'
}
}));
These are some articles and tutorials that could help you getting started with Rust and Warp.
Author: EstebanBorai
Source Code: https://github.com/EstebanBorai/msend-server
#react #javascript #reactjs #rust