Websocket Server for Msend a Minimalistic Messaging Application Made with Reactjs and Rust

msend-server

WebSocket server for msend a minimalistic messaging application made with ReactJS and Rust

Motivation

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.

Development

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.

  1. Clone the repository locally
https://github.com/EstebanBorai/msend-server.git
  1. Install dependencies and execute the server
cd msend-server

RUST_LOG=info cargo run

A warp server will listen on ws://127.0.0.1:8080/.

Getting Started

You must complete all steps on Development section in order to follow the steps on this section.

Sending a message

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!'
  }
}));

References

These are some articles and tutorials that could help you getting started with Rust and Warp.

Download Details:

Author: EstebanBorai

Source Code: https://github.com/EstebanBorai/msend-server

#react #javascript #reactjs #rust

Websocket Server for Msend a Minimalistic Messaging Application Made with Reactjs and Rust
3.50 GEEK