Size of a string to send over socket

I hope this hasn’t been asked yet, or has clearly been stated.

I’ve been trying to serialize a custom object to string, so i can send it over a socket connection in the scriptwriter.
But the String is too big to send, i’ve looked around for the allowed size of a string but couldn’t find any.
Currently just halving my string till i find the right amount, but a set number would help a lot!

Do you use socket_send_string script or append_line() in the generateScript method in the API? And can you show the serialize a custom object to string… result - what do you get if you print the string?