function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Suraj PSuraj P 

Is the use of WebSockets supported in Lightning Components?

I am trying to build a CTI adapter. But I keep getting the error: "Failed to construct 'WebSocket': Please use the 'new' operator, this DOM object constructor cannot be called as a function.". Is this a know limitation?
Florian.GümbelFlorian.Gümbel
Yes, you can use it.
But unfortunately your WebSockets can't connect to services outside Salesforce due CSP.
For this you should have added a CSP rule in setup. But actually SF only allows http and https protocols as CSP url value.

You can vote for this:
https://success.salesforce.com/ideaView?id=0873A000000E5nmQAC

We need some more votes for this!

To build a WebSocket just code:
var socket = new window.WebSocket('ws://youttarget');