networker-rs
networker-rs is a Rust library that provides networking utilities for TCP, UDP, WebSocket, and HTTP functionalities, inspired by Go's net package and JavaScript's socket.io. It simplifies common networking tasks and enables event-driven networking with an easy-to-use API.
Latest update: Made newline delimiters
Features
-
TCP Support
- Dial connections to a specified address.
- Listen for incoming connections.
- Emit events and handle specific message events.
- Utility to read and write to TCP streams.
-
UDP Support
- Send messages to a specified address.
- Receive messages on a specified address.
-
WebSocket Support
- Connect to WebSocket servers.
- Start a WebSocket server and handle bidirectional communication.
- Emit and listen for events/messages.
-
HTTP Support
- Simple HTTP GET and POST request functionality.
Installation
Add the following to your Cargo.toml:
[]
= "0.2.0" # Replace with the latest version
Example Usage
TCP Example
use EasySocketServer;
UDP Example
use EasySocketServer;
WebSocket Example
use EasySocketServer;
HTTP Example
use EasySocketServer;
async
You can also get socket ids by doing either
// client side
// server side
License
This project is licensed under the MIT License. See the LICENSE file for details.