2013-04-11, 05:09
@Montellese: Can individual JSON socket responses be terminated by a "\n" (or even "\0"/null, whatever is most suitable).
While performing a video library rescan I tried to run some JSON queries (eg. GetMovies) and the response I got over sockets included not only the movie data, but also concatenated on the end of this response was a VideoLibrary.OnUpdate notification. Since this response now contained two messages, it was impossible to parse.
At least if each message in a response were terminated with a "\n" it might be possible to split the response into individual messages (sub-responses) and process them individually. Without any suitable termination this is nigh on impossible. Terminators would also simplify socket reading, as you could more easily tell when all the available data has been read, by checking for a terminator within the retrieved data.
While performing a video library rescan I tried to run some JSON queries (eg. GetMovies) and the response I got over sockets included not only the movie data, but also concatenated on the end of this response was a VideoLibrary.OnUpdate notification. Since this response now contained two messages, it was impossible to parse.
At least if each message in a response were terminated with a "\n" it might be possible to split the response into individual messages (sub-responses) and process them individually. Without any suitable termination this is nigh on impossible. Terminators would also simplify socket reading, as you could more easily tell when all the available data has been read, by checking for a terminator within the retrieved data.