As the documentation states, you cannot encode resource types with
json_encode. The current code attempts to do this because the class
minecraftRcon exposes the property
$_Sock whose value is a resource.
However, it's not clear exactly why your JS/PHP code is not working as a whole. Since you can't access (or even see) anything "inside" a resource value from PHP it's almost certain that you are not trying to do that from JS, so while the warning is valid and you should fix it, it probably does not bear at all on your current problem.