Work out the socket URL to connect to.
A device needs one URL and there is only one it can sensibly want, so most configurations should not have to write it out. Everything here has a default:
#{} wss://devices.nervescloud.com/device-socket/websocket?vsn=2.0.0
#{host => "nh.example.com"} wss://nh.example.com/device-socket/websocket?vsn=2.0.0
#{url => "ws://192.168.1.10:4000"} ws://192.168.1.10:4000/device-socket/websocket?vsn=2.0.0
Anything already there is kept, so a URL written out in full is passed through untouched and an unusual mount point survives.
NervesHub serves the device socket at two paths and which one to use depends on how the device authenticates.
A device with a client certificate connects to the device endpoint, where the
socket is at /socket. A device with a shared secret goes through the web
endpoint instead, where /socket is already taken by the browser socket and
the device socket is at /device-socket.
| default_host/0 | |
| resolve/1 | Build the URL an agent config asks for. |
default_host() -> binary()
resolve(Config::map()) -> {ok, binary()} | {error, term()}
Build the URL an agent config asks for.
Generated by EDoc