If you have a C++ plugin then you don't need to code in extendscript to make this call, it would be too much hassle.
Other easier options that you can use are
Leverage CEP where you can write the code like what @Eugene Tyson wrote and then use CSXS events to trigger the call to method in JS side. Read about it, this could be the fastest way if you have no aversions to using a CEP extension(invisible if you would like that).
Another approach would be to code this https call making in C++ and if this has to be trigerred via jsx then you can expose the method via the scripting interface.
If you still want to use the socket object of extendscript then I am worried you would have to implement everything on your own, much of what happens when a webcall is made would have to be handled explicitly. Some information about this in discussion https://community.adobe.com/t5/illustrator-discussions/how-to-access-https-site-from-javascript-socket-object/td-p/7199314
If you know C++ you can also create an external object which can be loaded by Extendscript and provide this capability. One such solution is https://coppieters.nz/?p=310
-Manan
... View more