I have an EchoServer Websocket code to connect the live call which gives the response in the format like 7\x00E\x00Y\x00u\x00\x97\x00\xb2\x00\xb9\x00\xac\x00\x98\x00\x87\x00x\x00[\x00
My code :Echoserver.py
class WSHandler(tornado.websocket.WebSocketHandler):
def open(self):
print("Websocket Call Connected")
@gen.coroutine
def on_message(self, message):
print ("message====>",message)
watson = yield self.watson_future
if type(message) == str:
watson.write_message(message, binary=True)
else:
data = json.loads(message)
data['action'] = "start"
data['continuous'] = True
data['interim_results'] = True
print (json.dumps(data))
watson.write_message(json.dumps(data), binary=False)
@gen.coroutine
def on_close(self):
print("Websocket Call Disconnected")
def on_watson_message(self, message):
How to write the mp3 file from my response what i have mentioned above?? Any suggestions will be highly appreciated.
Response
7\x00E\x00Y\x00u\x00\x97\x00\xb2\x00\xb9\x00\xac\x00\x98\x00\x87\x00x\x00[\x00(\x00\xf0\xff\xd8\xff\xfd\xffX\x00\xbb\x00\xf8\x00\x04\x01\xf8\x00\xf2\x00\xf8\x00\xf9\x00\xe7\x00\xc4\x00\x99\x00i\x007\x00\t\x00\xea\xff\xdb\xff\xd6\xff\xd0\xff\xca\xff\xca\xff\xd6\xff\xe9\xff\xfa\xff\x04\x00\x05\x00\x06\x00\x0b\x00\x12\x00\x15\x00\x12\x00\x0b\x00\x06\x00\x06\x00\x07\x00\n\x00\x10\x00\x16\x00\x1a\x00\x1a\x00\x18\x00\x16\x00\x12\x00\t\x0