#tcp-socket #sockets #micro-controller #devices #server #communication #esp

easy_esp

Wrapper around socket functionality to make using devices safer and easier

8 releases (4 breaking)

0.5.0 May 1, 2024
0.4.1 May 1, 2024
0.4.0 Apr 28, 2024
0.3.0 Apr 26, 2024
0.1.1 Apr 22, 2024

#15 in #esp

MIT license

16KB
215 lines

Easy ESP

This is a work in progress

This Crate is just a wrapper of TCP socket functionality to make a simpler interface and format for dealing with socket connections

This crate was initially created to simplify communication with the ESP microcontroller but has turned to a more general and friendlier solution for most other applications

There is a specific format that this messaging system follows, so we have listed on this projects GitHub some simple socket programs to run on a variety of micro controllers and devices

Structure

Its been decided that this server will use a simple Request Response protocol for easier usage

In this Crate the Server has been broken up into two parts.

  • Server (Responsible for handling sockets, message transfer, and clients)
  • Handler (Responsible for dealing with any client request and producing a response)

This Crate has implemented the Server component so users of this Crate must create their own custom implementation of a handler.

To aid people in creating handlers and to offer a guide there are a few handlers already made for convenience.

  • Chat room
  • Database
  • Secure chat room

Handler

A component a user must build themselves to handle any message that comes and return some response message with a optional server command Handlers must implement the handler trait to handle and String request and return a String response

Server CMD System

Server can receive requests from handler to do some command server side from a list of commands

server is capable of: - ShutDown (Shuts down server or client) - SendAll (Sends some message to all clients)

Dependencies

~4–12MB
~126K SLoC