[SalesForce] Apex Websocket server

Is there way to connect to apex code with wss (websocket) protocol?

I successfully connected to an external url from Salesforce client component, but I am wondering if there is a way to create a websocket server in Salesforce and connect to it from a client component.

Thank you!

Best Answer

Apex only supports HTTP/1 from early 2000's . WebSocket server or GRPC(HTTP/2) are bi-directional and quite latest mid/late 2010's. So natively in Salesforce Apex you cant achieve this.

Client Component you can do that using Javascript, as its websocket API isnative to JS. You have to stick with aura/lwc component.

You can raise an idea for its support in apex here.

Related Topic