Web3.js(how the smart contract connected to the front end)
In the above image we can easily understand the working of the RPC in the image client request to the server then server working on it that working is taken place in the network and it give response back to the client.
what happen in it client make the call to the procedural protocol then server work on that call till client wait for the server to response as soon as the server working on the call and give response back to the client after this client start working on the another call/request.The client make the local procedure call if client want to add two value 3 and 4. Then client stub packed it in the box and send to the network routines of the local kernel of operating system. The box which contain the parameters of 3 and 4 for adding send to the remote kernel of the operating system and that parameters send to the server stub for processing on it.Then server stub open the box which transfer from the client stub to the server for adding two value .Then server working on it and in the reverse procedure it pass to the client again and then client again start on the next call.