Skip to content

Latest commit

 

History

History
114 lines (81 loc) · 3.59 KB

File metadata and controls

114 lines (81 loc) · 3.59 KB

Project logo

WebSocket Bridge Server

Status GitHub Issues GitHub Pull Requests License


Few lines describing your project.
This project implements a WebSocket server as an intermediary bridge between clients and a REST API. The WebSocket server is implemented as a static library in C++ and integrated into Go, providing a seamless layer for real-time communication. The primary purpose of the server is to accept WebSocket connections from clients and forward requests to the specified REST API for processing. This setup enables efficient interaction between clients and server-side logic.

📝 Table of Contents

🧐 Key Features

  • WebSocket as an intermediary layer : Acts as a bridge between WebSocket clients and REST API.
  • Static library implementation : The WebSocket server is implemented as a static C++ library, ensuring high performance and independence from external dependencies.
  • Integration with Go : Go is used to manage the WebSocket server, simplifying development, configuration, and execution.
  • YAML-based configuration : Server settings (host, port, REST API parameters) are defined in the config.yaml file.

🏁 Requirements

To work with this project, you will need:

  1. Go (version 1.20 or higher)
  2. A C++ compiler with support for the C++11 standard
  3. Libraries: Boost, OpenSSL
  4. The yaml.v3 utility for configuration handling

Project Structure

  • main.go : The main application file that manages starting, stopping, and deleting the WebSocket server.
  • config.yaml : Configuration file containing host, port, and REST API settings.
  • go.mod , go.sum : Files for managing Go dependencies.
  • Static WebSocket library : Implementation of the WebSocket server in C++ (compiled as a static library).

Installation and Execution

1) Clone the repository :

git clone https://github.com/warjohn/WebSocket.git
cd /in/directory

2) Build C++ lib

mkdir /in/directory/build
cd build
camke ..
make

3) Copy lib to GO foler

cp /in/directory/build/libsocket.a /path/to/your/GO_folder

4) Install Go dependencies :

go mod download

5) Configure settings :

host: "localhost"
port: 8080
rest_api_host: "api.example.com"
rest_api_port: 8000

6) Run the application :

./main

🎈 Usage

  • A client connects to the WebSocket server:
ws://localhost:8080
  • The WebSocket server forwards client requests to the REST API:
http://api.example.com:8000
  • Responses from the REST API are sent back to the client via WebSocket.

✍️ Authors

If you have any questions or want to suggest improvements, create an issue in the repository or contact the author directly.