This will work only for very small images otherwise the Websocket connection will fail:
Connection Closed: 1009 The decoded text message was too big for the output buffer and the endpoint does not support partial messages
This was also discussed here: Websocket reconnects after sending large signal
Also take in consideration that base64 encoding will increase the file size with 33%.
But now that I think better my solution would also probably fail because the peer connection is done with the KMS server - unless it does the data channel relaying.