Re: Dedicated Server API Client Communication
Posted: 16 Apr 2014, 17:47
After fiddling with this a bit, I found a drawback and I'm not sure what to do with it... XMLRPC has two particular types, base64 and dateTime.iso8601, which aren't handled very nicely by the xmlrpc extension. To encode them, you have to call xmlrpc_set_type which actually wraps them into small objects and the decoding returns objects for them.
For dateTime, I don't think it's used by the dedicated in any method or callback so nobody probably care if encoding/decoding doesn't give the same results in both functions (xmlrpc one and mine).
However, base64 is useful for tunnelling data and writing files. Encoding isn't an issue as an object is already used (I just modified it a bit so it works in both functions) but decoding is: it was usually sending back only the decoded string so this is what I'm doing in my function but the xmlrpc returns an object... Two solutions:
- my function returns an object
=> it'll break any project using the TunnelDataReceived callback and the GetValidationReplay method
- strings from the xmlrpc return are unwrapped
=> it needs to use array_walk_recursive but it's so slow (around x3 factor) it makes it even slower than my function for small requests...
I'm prefering the first one, as it's easily fixable:
- the method return can be unwrapped in the Connection class directly (so it's not even a real issue ^^)
- the callback is generally handled by a callback manager which can then do the unwrapping
But if anyone has another point of view or another solution, feel free to share it ^^
Edit: I did the first choice, feel free to test!
For dateTime, I don't think it's used by the dedicated in any method or callback so nobody probably care if encoding/decoding doesn't give the same results in both functions (xmlrpc one and mine).
However, base64 is useful for tunnelling data and writing files. Encoding isn't an issue as an object is already used (I just modified it a bit so it works in both functions) but decoding is: it was usually sending back only the decoded string so this is what I'm doing in my function but the xmlrpc returns an object... Two solutions:
- my function returns an object
=> it'll break any project using the TunnelDataReceived callback and the GetValidationReplay method
- strings from the xmlrpc return are unwrapped
=> it needs to use array_walk_recursive but it's so slow (around x3 factor) it makes it even slower than my function for small requests...
I'm prefering the first one, as it's easily fixable:
- the method return can be unwrapped in the Connection class directly (so it's not even a real issue ^^)
- the callback is generally handled by a callback manager which can then do the unwrapping
But if anyone has another point of view or another solution, feel free to share it ^^
Edit: I did the first choice, feel free to test!