Client-server communication
Fundamentally, any communication between the user’s chosen device (the client) and the data and logic available on the Salesforce server occurs using the HTTP protocol. As a Lightning developer, you rarely get involved with the low-level aspects of forming the correct HTTP POST
or HTTP GET
request to the server and parsing the responses:
- For LWC, the
@wire
protocol can be used to bind properties in your client-side controller to methods in your Apex code. - For Lightning Aura Components, the
$A.enqueueAction
JavaScript method can be called from a component’s client-side controller method to access the Apex code. - For Visualforce, the
apex:commandButton
andapex:actionFunction
components can be used to invoke Apex code.
Salesforce also takes care of the security aspects for you, ensuring that the user is logged in and has a valid session to make the request to the server. There are also a number of options to perform...