How can i create a custom protocol with ws scheame ?
ex: ws://localhost/echo or ws://localhost:8080/echo with node js ?

Strictly speaking, that’s not actually a protocol; as you indirectly infer, it’s a “scheme” that in effect tells the browser what to do with the rest of the URI.

Unfortunately, as yet, there’s no good cross-browser way to do this. W3C has been working on it, but the only browser with an implementation so far is Firefox (see the article on web-based protocol handlers).

If you really want such a scheme to be used far and wide, though, you’ll likely have to try to register it with IANA, in which case, a read through RFC 7595 would be in order.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.