Build a NetAddress object and parse address
string address to parse, accept an url format with protocol and path (http://)domain(:port/path)
Optional
defaultPort: numberset a default port to use if there is no port in the string address parsed
Private
_addressPrivate
_domainPrivate
_hostPrivate
Optional
_portThe domain part from address (http://)domain(:port/path)
The host part from address (http://)domain:port/path)
The port part from address (http://)domain(:port/path)
, or defaultPort if passed in NetAddress constructor
Static
fixStatic help function to build an end point from an address (proto://)domain(:port/path)
Mainly it fix the protocol, in addition if:
protocol to set in the end point returned
string address to fix with protocol as indicated
the end point built
console.log(NetAddress.fixProtocol('ws','http://domain/path')) // 'ws://domain/path'
console.log(NetAddress.fixProtocol('ws','https://domain/path')) // 'wss://domain/path'
console.log(NetAddress.fixProtocol('wss','http://domain/path')) // 'ws://domain/path'
Generated using TypeDoc
Help class to manipulate and parse a net address. The Address can be only the domain field, or a URL format with protocol and path part
(http://)domain(:port/path)
Example