version: c2cvia-server-php v? build2024-12-21r1
Special server acting as middleman for client-to-client P2P (Peer-to-peer) networks.
Participants are regular http clients. Since none of them are real http servers, they acting as SimClient-s and SimServer-s and comunicate over C2CVIA.
One of the participants must act as SimServer.
Other participants can act as SimClient.
Participant who act as SimServer can also act as SimClient.
rid is unique id for every sim_req/sim_res pair. rid is created on C2CVIA when SimClient push sim_req.
net is network name that differentiate one network from another on single C2CVIA. That allow participants to simultaneously do different things on different networks on single C2CVIA.
token differentiate one SimClient from another. So client can not get sim_res of another clients
Things like route "/peer/", multicast (data is only sent once but received by multiple participants interested in the same content) one-to-many and many-to-many, broadcast (every participant receives the same data, regardless of whether it is requested), and unicast messaging SimClient to SimClient are in development...
Request body (for POST)
Currently only supported is:
Content-Type: application/json
or
Content-Type: application/x-www-form-urlencoded
sim_req:
const {
simEndpoint,
simHeaders,
simBody,
simQueryParams,
simRouteParams
} = sim_req;
Routes are:
// CLIENT API
POST or GET /api/v1/client/login
POST /api/v1/client/pushreq
GET /api/v1/client/check
GET /api/v1/client/pullres
GET /api/v1/client/pullsmart
// SERVER API
GET /api/v1/server/pullreqsmart
POST /api/v1/server/pushres
Request method | POST or GET |
Route | /api/v1/client/login |
Description | SimClient get token in return. Token is used to differentiate what requests and responses are for him. |
Request method | POST |
Route | /api/v1/client/pushreq |
Description | ... |
Request method | POST |
Route | /api/v1/client/check |
Description | ... |
Request method | POST |
Route | /api/v1/client/pullres |
Description | ... |
Request method | POST |
Route | /api/v1/client/pullsmart |
Description | It is combination of SimClient check and SimClient pull response. ... |
Request method | POST |
Route | /api/v1/server/pullreqsmart |
Description | ... |
Request method | POST |
Route | /api/v1/server/pushres |
Description | ... |