-
Notifications
You must be signed in to change notification settings - Fork 23
address + port vs uri #17
Description
Looking to provide a Web API friendly version for our Raw Socket API, implemented by most platforms
I'll start with this first thought: "address + port vs uri"
In different places, we have to handle local and remote addresses and ports
The File API works with "blob:" URI scheme: http://www.w3.org/TR/FileAPI/#url
File API: Directories and System evoke a "filesystem:" uri scheme: http://www.w3.org/TR/file-system-api/#widl-Entry-toURL-DOMString
This which might be replaced by the recently proposed "app:" uri scheme in the context of packaged app: http://app-uri.sysapps.org/
And of course, the Web Socket API use the "ws:" and "wss:" uri schemes:
- http://www.w3.org/TR/websockets/#dom-websocket
- http://www.w3.org/TR/websockets/#refsWSP
- http://tools.ietf.org/html/rfc6455#section-11.1
It would then looks natural to me to use "tcp:" and "udp:" uri schemes
They could, as "http:", "ws:", "ftp:" and others, integrate the authority part in which can be specified the port number;
http://tools.ietf.org/html/rfc3986#section-3.2
I didn't saw yet "tcp:" uri scheme but "udp:" is listed as a "provisional uri scheme":
Its basic syntax clearly show the "port" information:
udp://<server>[:<port>]/
A more advanced syntax provide additional informations, including multicast one:
udp://[<localaddress>@]<destination|multicastgroup>[:<port>]
The little issue is that it has been semantically declared for "MPEG Transport Stream over UDP" instead of only "UDP"
One would say it might be easier to set address and port values to specific parameters or properties compared to constructing a text URI and potentially specify a new scheme.
But if some followed my point, they also think about the recent URL API : http://url.spec.whatwg.org/
- which may be expanded to support them
- or be the basis for a similar API supporting different schemes (URI instead of URL?)
An advantage, while potentially requiring such URI API, would be a simplification of the socket interfaces making them even more similar to the web socket one
It means for example that UDPMessageEvent could be a standard MessageEvent instead in which the remote address and port would be specified in the "origin" attribute:
- http://raw-sockets.sysapps.org/#interface-udpmessageevent
- http://www.w3.org/TR/webmessaging/#dom-messageevent-origin
It lets also room of course for "tcps:" and "udps:" uri schemes to handle ssl
(but we still need to think of the "exchange server" use case requiring deferred updateToSSL)