sysapps / tcp-udp-sockets

Raw sockets API
85 stars 25 forks source link

A design based on Streams? #57

Closed ClaesNilsson closed 10 years ago

ClaesNilsson commented 11 years ago

See https://dvcs.w3.org/hg/streams-api/raw-file/tip/Overview.htm and https://github.com/whatwg/streams

marcoscaceres commented 11 years ago

I would disregard the first link for now. Only look at the WHATWG.

ClaesNilsson commented 11 years ago

Conclusions from SysApps meeting at TPAC Nov 12, 2013:

We should work on a Raw Socket API based on Streams. However, the Streams work is complicated and will take time, at least a year, to stabilize. The decisions were:

marcoscaceres commented 11 years ago

The only way to speed up the Stream work is to contribute directly to it and force it to be tested by having something "real" built on top of it. The Socket API should focus itself primarily on connection management, securing the connection, and so on. I would not be in favor of having two versions - twice the work, risk of confusing everyone.

ytrezq commented 11 years ago

Sorry, but I'm not a real expert: What would be the differences with Streams, if I want to create an FTP server with PASSIVE mode (for example)? Would it be harder?

marcoscaceres commented 11 years ago

It certainly would not be harder. You would just wrap a TCP socket and layer the FTP protocol on top. You would, of course, need to implement the protocol yourself - but that's kinda the point of this interface.

Something like:

class FTP{
   var socket; 
   constructor(options){
      var address = URL(option.address).authority; 
      socket = new TCPSocket(address); 
   }

  /*IMPLEMENT FTP COMMANDS* 
 function pwd(){ ... }
 ... and so on... 
}
ClaesNilsson commented 11 years ago

Marcos, the idea is to handle most outstanding issues, most of them small, and publish a new public working draft that is a "snapshot" on where we are now. After that my plan is to gradually adapt the editor's draft to Streams.

So having two parallell tracks is maybe not correctly expressed. We have the public draft as "backup".

My focus is Streams and as you see I have an ongoing mail dialogue with Domenic but will start to provide input on their Github page.

marcoscaceres commented 11 years ago

I think republishing sends the wrong message (and has little value, as it doesn't mean we would get any additional contributions). We should only republish with the W3C once we are ready for LC. In the mean time, if we want more reviews and contributions, it would be best to directly seek out domain experts instead of hoping that by republishing they will come to us. For those that do find the version on the /TR/ page, they will be looking at a grossly outdated version, which will either confuse them or put them off.

ClaesNilsson commented 10 years ago

The TCPSocket interface has now been rewritten to be based on streams according to the discussion at the WHAT Streams API repo, https://github.com/whatwg/streams/issues/64.

The PR is https://github.com/sysapps/tcp-udp-sockets/pull/63.

I am now continuing with UDP and TCPServer interfaces.

ClaesNilsson commented 10 years ago

A short status update of this issue that the UDPSocket and TCPSocket interfaces have been rewritten to be based on Streams. TCPServer still remains.

ClaesNilsson commented 10 years ago

Now completely rewritten to be based on the Streams API, https://streams.spec.whatwg.org/

domenic commented 10 years ago

<3