Python - Send file through JSON
问题 I'm trying to create a live chat application using ws4py (if there are better socket libraries I would love recommendations) and I want to implement file transfer (specifically .wav files) in my application. For text chat messages I'm currently using the JSON library to send a serialized dictionary over my sockets and decode them on either side. Something like this message = raw_input("Message: ") payload = {"username": self.username, "message": message} payload["type"] = constants.CHAT