https://github.com/x4raynixx/resend
Resend is a module for quickly creating servers that listen for incoming connections and send data across networks — fast, simple, and efficient.
https://github.com/x4raynixx/resend
Last synced: 28 days ago
JSON representation
Resend is a module for quickly creating servers that listen for incoming connections and send data across networks — fast, simple, and efficient.
- Host: GitHub
- URL: https://github.com/x4raynixx/resend
- Owner: x4raynixx
- License: apache-2.0
- Created: 2025-05-01T02:29:59.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-05-05T13:10:19.000Z (about 1 month ago)
- Last Synced: 2025-05-08T22:55:06.658Z (28 days ago)
- Language: C#
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Resend
Resend is a fast and efficient module for creating servers that listen for incoming connections and send data across networks.
## Installation
1. **Download the DLL** from the [Releases](https://github.com/x4raynixx/resend/releases).
2. **Add the DLL** to your project (e.g., place it in a folder).
3. **Reference the DLL** in your project by right-clicking your project > **Add > Reference** > Browse to the DLL.## Usage
### 1. Configure the Server
```csharp
using Resend;public class Program
{
public static void Main(string[] args)
{
Resend.Configure(new ResendConfig
{
GlobalAccess = true,
Routes = new List { new ResendRoute { Name = "chat", Route = "chat/send" } }
});Resend.StartAsync(5000).Wait();
}
}
```### 2. Define Routes
```csharp
Resend.On("chat/send", (message) =>
{
return $"Message: {message}";
});
```### 3. Sending Messages
```csharp
static async Task SendMessageToServer(string message)
{
var socket = new System.Net.WebSockets.ClientWebSocket();
await socket.ConnectAsync(new Uri("ws://localhost:5000/ws/"), CancellationToken.None);string jsonMessage = $"{{\"route\": \"chat/send\", \"data\": \"{message}\"}}";
byte[] messageBytes = Encoding.UTF8.GetBytes(jsonMessage);
await socket.SendAsync(new ArraySegment(messageBytes), System.Net.WebSockets.WebSocketMessageType.Text, true, CancellationToken.None);byte[] buffer = new byte[4096];
var result = await socket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None);
string response = Encoding.UTF8.GetString(buffer, 0, result.Count);
Console.WriteLine($"Server response: {response}");socket.CloseAsync(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).Wait();
}
```## Summary
1. **Download and reference the DLL**.
2. **Configure the server** with routes.
3. **Send messages** via WebSocket.