2016-07-07, 19:49
Hi,
I'm having an ugly little problem with the server responses using websocket.
I'm using a websocket connection to communicate to Kodi server, but I cannot handle the responses depending on what they are responding for. I was able to implement a workaround to handle the requests synchronously, but it's not a gentle solution and it doesn't work perfect. I can't relay on the server response to parse the received data because I don't know what server it's responding for.
For example, if I send a request to the server by using the api method "Application.GetProperties", I can receive the response to that call. But I can receive any other response (like a notification for OnStop, for example) between that method call and its response.
It would be perfect that the Kodi server includes in the response what method is responding for. If you invoke the "Application.GetProperties" method, the server response will include a param with: "method":"Application.GetProperties". I wonder why this was not contemplated when websocket connection were added.
Of course using HTTP there is no problem at all, because of the connection protocol. This problem occurs only when using a websocket connection.
Thank you all!
I'm having an ugly little problem with the server responses using websocket.
I'm using a websocket connection to communicate to Kodi server, but I cannot handle the responses depending on what they are responding for. I was able to implement a workaround to handle the requests synchronously, but it's not a gentle solution and it doesn't work perfect. I can't relay on the server response to parse the received data because I don't know what server it's responding for.
For example, if I send a request to the server by using the api method "Application.GetProperties", I can receive the response to that call. But I can receive any other response (like a notification for OnStop, for example) between that method call and its response.
It would be perfect that the Kodi server includes in the response what method is responding for. If you invoke the "Application.GetProperties" method, the server response will include a param with: "method":"Application.GetProperties". I wonder why this was not contemplated when websocket connection were added.
Of course using HTTP there is no problem at all, because of the connection protocol. This problem occurs only when using a websocket connection.
Thank you all!