Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

address + port vs uri #17

@AMorgaut

Description

@AMorgaut

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:

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:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions