rxwebsocket
rxwebsocket copied to clipboard
Support custom payload exchange
Right now we only expose exchanging messages via the same methods that the original okhttp WebSocketListener uses, i.e. String and ByteString. We could introduce a mechanism similar to Retrofit Converters to exchange custom strongly typed messages. We need to consider that the request types and response type might be different, too. Also this might be a good place to introduce the EnvelopeJsonAdapter. Basically when building the RxWebSocket we would provide the Converter Factory. And then listening to a specific type of responses would try to search for an appropriate converter to deal with the payload. Same with sending requests. Not sure if it makes sense without codegen, too.