Anvil Server disconnects when large amounts of data are passed back

I came to this topic searching for a solution, and noticed that while the solution is basically correct, later on there has been a change regarding Media objects, see
["TypeError: BlobMedia content must be a byte string" when generating BlobMedia csv file]

So now it seems you need to have on the server:
return anvil.BlobMedia("application/json", json.dumps(data).encode())
And at the other end:
data = json.loads(returned_media.get_bytes().decode('utf-8'))

2 Likes