Skip to content

zakaria-hammal/IHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ihub

ihub is a lightweight C-based client–server framework for sending JSON messages over TCP or TLS connections.
It mimics WebSocket-style communication but does not fully implement the WebSocket protocol — it’s intended for learning and prototyping only.


📁 Project structure

.
├── ihubserver.c
├── ihubserver.h
├── ihubclient.c
├── ihubclient.h
└── README.md

🚀 Overview

  • ihubserver — a simple epoll-based server that accepts multiple clients and routes JSON messages based on an "action" field.
  • ihubclient — a small client that connects to the server (over HTTP or HTTPS) and sends/receives JSON messages.
  • Uses cJSON for JSON parsing and OpenSSL for optional TLS.

🧱 Build

You’ll need:

  • gcc (or any C11 compiler)
  • libssl-dev and libcjson-dev

Example:

gcc yourserver.c ihubserver.c -o server -lssl -lcrypto -lcjson
gcc yourclient.c ihubclient.c -o client -lssl -lcrypto -lcjson

▶️ Run

Start the server:

./server

Start a client (example sketch):

startConnection("http://127.0.0.1:8080/");
On("hello", hello_handler);
Invoke("sayHello", (char*[]){"Alice"}, 1);

💬 Message format

Messages are plain JSON:

{
  "action": "sayHello",
  "params": ["Alice"]
}

Server responses:

{
  "response": "Hello Alice!"
}

⚠️ Note

This project does not fully implement the WebSocket protocol — it uses a simplified handshake and raw JSON over TCP/TLS.
It is meant for educational and experimental use only, not production deployment.


Special Thanks

A heartfelt thank you to Idir Belfodil for his invaluable support and encouragement during the developement of this project.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages