convert arraybuffer to data received from websocket stream for mediasource code example

Example 1: how to read a json resposnse from a link in python

import urllib, json

url = "put url here"
response = urllib.request.urlopen(url)
data = json.loads(response.read())
print (data)

Example 2: read data from webserver lopy

import urequests
sensorreading = 'whatever'
res = urequests.post('http://yourserver/endpoint', json={'my_sensor': sensorreading})
res.close()
if (res.status_code - 200) < 100: # check that response code is in the 200 range
    print('done')
else:
    print('there was some error')