Transform Services https URL to websocket URL and related questions
When I use the services API to get info about the services, ik get following resonse:
{"api":"Services","mt":"ServicesInfo","services":[{"name":"devices","title":"Devices","url":"https://10.0.0.241/xqting.be/devices/innovaphone-devices","info":{"apis":{"com.innovaphone.devices":{}}}},{"name":"devices-api","title":"DevicesApi","url":"https://10.0.0.241/xqting.be/devices/innovaphone-devices-api","info":{"apis":{"com.innovaphone.devices":{}}}},{"name":"files","title":"Files","url":"https://10.0.0.241/xqting.be/files/innovaphone-files"},{"name":"files-api","title":"FilesApi","url":"https://10.0.0.241/xqting.be/files/innovaphone-files-api","info":{}}]}
Two things are remarkable here:
- I get 2 items for the api com.innovaphone.devices. This is probably because in the config of my app object I have both devices and devices-api checked in my app object configuration. But which one do I really need to be able to connect to the devices? Is it corret to assume one only needs access to the devices-api? Whats the difference in the context of an app object?
- the URLs provided for the devices app for examle is https://10.0.0.241/xqting.be/devices/innovaphone-devices. However, when I use the Services API and execute following commands
IService* devicesService = _servicesApi->GetService("com.innovaphone.devices");
...
devicesService->GetWebsocketUrl()
I see from the logging the websocket URL is wss://10.0.0.241/xqting.be/devices/
What is the logic to move from the https:// to the wss:// URL. Because there is a part "stripped" of the https URL. Is it always the last part that must be removed, or, is this wss url constructed in a different way?
Suppose I want to do the same for the files api (assuming I have to use the API), do I transform https://10.0.0.241/xqting.be/files/innovaphone-files-api to wss://10.0.0.241/xqting.be/files just by dropping the last and replace https with wss?
and finally: what happens if there are for example multiple instances of the files apps? Are there then also mutliple instance of the files api? and if so, how this URL composition work then?