SimpleWebSocketServer.SIBS.Lib
                              
                            
                                1.0.20
                            
                        
                    See the version list below for details.
dotnet add package SimpleWebSocketServer.SIBS.Lib --version 1.0.20
NuGet\Install-Package SimpleWebSocketServer.SIBS.Lib -Version 1.0.20
<PackageReference Include="SimpleWebSocketServer.SIBS.Lib" Version="1.0.20" />
<PackageVersion Include="SimpleWebSocketServer.SIBS.Lib" Version="1.0.20" />
<PackageReference Include="SimpleWebSocketServer.SIBS.Lib" />
paket add SimpleWebSocketServer.SIBS.Lib --version 1.0.20
#r "nuget: SimpleWebSocketServer.SIBS.Lib, 1.0.20"
#:package SimpleWebSocketServer.SIBS.Lib@1.0.20
#addin nuget:?package=SimpleWebSocketServer.SIBS.Lib&version=1.0.20
#tool nuget:?package=SimpleWebSocketServer.SIBS.Lib&version=1.0.20
SimpleWebSocketServer
A simple WebSocket server implementation in C# using SimpleWebSocketServer.SIBS.Models and Newtonsoft.Json for JSON parsing.
Overview
SimpleWebSocketServer.SIBS is a lightweight WebSocket server library designed to handle various types of WebSocket messages, including terminal status responses, authentication credential requests, payment processing requests, event notifications, and error notifications.
Features
- Handle client connections
- Receive and parse different types of messages
- Send messages to clients
- Event-driven architecture for handling different message types
Getting Started
Prerequisites
- .NET Framework (4.6.1 or later) or .NET Core/5.0+
- Newtonsoft.Json package
Installation
- Clone the repository: - git clone https://github.com/yourusername/SimpleWebSocketServer.SIBS.git
- Navigate to the project directory: - cd SimpleWebSocketServer.SIBS
- Install the required NuGet packages: - dotnet add package Newtonsoft.Json dotnet restore
Usage
- Create an instance of - WebSocketServerSibsand start the server:- using SimpleWebSocketServer.SIBS; var webSocketServer = new WebSocketServerSibs(); webSocketServer.Start("http://localhost:5000/");
- Subscribe to the events to handle incoming messages and client connections: - webSocketServer.ClientConnected += (sender, e) => { Console.WriteLine("Client connected."); }; webSocketServer.TerminalStatusReqResponseReceived += (sender, response) => { Console.WriteLine("Received Terminal Status Response."); }; webSocketServer.SetAuthCredentialsReqReceived += (sender, response) => { Console.WriteLine("Received Set Auth Credentials Response."); }; webSocketServer.ProcessPaymentReqReceived += (sender, response) => { Console.WriteLine("Received Process Payment Response."); }; webSocketServer.EventNotificationReceived += (sender, response) => { Console.WriteLine("Received Event Notification."); }; webSocketServer.ErrorNotificationReceived += (sender, response) => { Console.WriteLine("Received Error Notification."); };
- Send a message to the client: - await webSocketServer.SendMessageToClient("Hello, client!");
Event Handling
The following events are available for handling:
- ClientConnected
- TerminalStatusReqResponseReceived
- SetAuthCredentialsReqReceived
- ProcessPaymentReqReceived
- EventNotificationReceived
- ErrorNotificationReceived
Example
Here's a complete example to demonstrate how to start the server and handle events:
using System;
using SimpleWebSocketServer.SIBS;
namespace WebSocketServerExample
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var webSocketServer = new WebSocketServerSibs();
            webSocketServer.Start("http://localhost:5000/");
            webSocketServer.ClientConnected += (sender, e) =>
            {
                Console.WriteLine("Client connected.");
            };
            webSocketServer.TerminalStatusReqResponseReceived += (sender, response) =>
            {
                Console.WriteLine("Received Terminal Status Response.");
            };
            webSocketServer.SetAuthCredentialsReqReceived += (sender, response) =>
            {
                Console.WriteLine("Received Set Auth Credentials Response.");
            };
            webSocketServer.ProcessPaymentReqReceived += (sender, response) =>
            {
                Console.WriteLine("Received Process Payment Response.");
            };
            webSocketServer.EventNotificationReceived += (sender, response) =>
            {
                Console.WriteLine("Received Event Notification.");
            };
            webSocketServer.ErrorNotificationReceived += (sender, response) =>
            {
                Console.WriteLine("Received Error Notification.");
            };
            // Send a message to the client
            await webSocketServer.SendMessageToClient("Hello, client!");
        }
    }
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
- Special thanks to contributors and maintainers.
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues for bug fixes, improvements, or new features.
Support
For support, questions, or suggestions, please open an issue.
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. | 
- 
                                                    .NETFramework 4.7.2- Newtonsoft.Json (>= 13.0.1)
- SimpleWebSocketServer.Lib (>= 1.0.9)
 
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | 
|---|---|---|
| 1.0.26 | 165 | 12/9/2024 | 
| 1.0.25 | 119 | 12/9/2024 | 
| 1.0.24 | 145 | 12/3/2024 | 
| 1.0.23 | 150 | 11/27/2024 | 
| 1.0.21 | 145 | 10/28/2024 | 
| 1.0.20 | 154 | 10/11/2024 | 
| 1.0.19 | 131 | 10/7/2024 | 
| 1.0.18 | 135 | 10/7/2024 | 
| 1.0.17 | 134 | 10/7/2024 | 
| 1.0.16 | 144 | 10/4/2024 | 
| 1.0.15 | 136 | 10/1/2024 | 
| 1.0.14 | 130 | 10/1/2024 | 
| 1.0.13 | 134 | 10/1/2024 | 
| 1.0.12 | 143 | 9/30/2024 | 
| 1.0.11 | 135 | 9/26/2024 | 
| 1.0.10 | 140 | 9/25/2024 | 
| 1.0.9 | 148 | 9/6/2024 | 
| 1.0.8 | 149 | 9/5/2024 | 
| 1.0.7 | 209 | 9/5/2024 | 
| 1.0.6 | 143 | 7/30/2024 | 
| 1.0.5 | 127 | 7/29/2024 | 
| 1.0.4 | 150 | 7/5/2024 |