ROUTE NOT FOUND

index.php

1752443291

file_content
string(21) "something bla bla 123"
file_content2
string(21) "something bla bla 123"
file_content3
string(21) "something bla bla 123" c2cvia-server-php

client-to-client-via-server (C2CVIA)

version: c2cvia-server-php v? build2024-12-21r1

Special server acting as middleman for client-to-client P2P (Peer-to-peer) networks.

How it works?

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

Under construction...

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...

How to use

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

SimClient login and get token in return immediately

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.

SimClient make request - client push request

Request method POST
Route /api/v1/client/pushreq
Description ...

SimClient check is there anything new for him

Request method POST
Route /api/v1/client/check
Description ...

SimClient pull response

Request method POST
Route /api/v1/client/pullres
Description ...

SimClient check is there answered response and pull response smart

Request method POST
Route /api/v1/client/pullsmart
Description It is combination of SimClient check and SimClient pull response. ...

SimServer check is there unanswered request and pull request smart (get_oldest_unanswered_req)

Request method POST
Route /api/v1/server/pullreqsmart
Description ...

SimServer send response - SimServer push response to C2CVIA

Request method POST
Route /api/v1/server/pushres
Description ...