wintercg / proposal-sockets-api

Proposal for an API for establishing TCP connections in Non-Browser JavaScript runtime environments
https://sockets-api.proposal.wintercg.org/
Other
46 stars 2 forks source link

Should we define a constructor for the Socket class? #9

Open Ethan-Arrowood opened 1 year ago

Ethan-Arrowood commented 1 year ago

https://github.com/wintercg/proposal-sockets-api/pull/8/#discussion_r1318762226

A constructor for {{Socket}} is intentially not specified, and is left to implementors to create.

Do we want to leave it like this? Are there reasons why implementors might want to create a constructor for Socket? If there are then it's better for us to capture that in this document and avoid every vendor creating their own constructor.

jasnell commented 1 year ago

We decided not to so that connect(...) is the only way to create a Socket instance.