Android how to send a file with OkHttp WebSockets-ThrowExceptions

Exception or error:

I’m using Retrofit with OkHttp to POST files via HTTPS requests and it works very well. Now I’m trying to implement an instant messaging feature in my app which should work seamlessly since OkHttp supports WebSockets. I have managed to establish the connection and send and receive text data without any problem but I’m stuck with sending/receiving files over WebSockets.

The method in question is :


Can someone provide a short example how to use this method to send a video file? Do I have to read the file in a stream?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *