Is it possible to use kotlinx-rpc over SSL? My und...
# kotlinx-rpc
j
Is it possible to use kotlinx-rpc over SSL? My understanding is that it's supposed to be carrier agnostic but I could not for the life of me get kRPC to work over WSS (web sockets secure). This is particularly noticeable on Android where I have to explicitly opt into clear text networking to get kRPC to work. It's possible I am missing something super obvious though. I couldn't find anyone talking about this on the internet so I figured it was worth an ask.
a
Hi! The procedure should be the same as with regular Ktor websockets, nothing more What problems do you face?
j
Copy code
2025-10-20 10:39:45.216 16428-16428 AndroidRuntime          org.example.demo                     E  FATAL EXCEPTION: main
                                                                                                    Process: org.example.demo, PID: 16428
                                                                                                    javax.net.ssl.SSLException: Unable to parse TLS packet header
Works fine when I switch the protocol to WS. I could have done something wrong for sure
a
Cc @Aleksei Tirman [JB]
Wild guesses for now Check that port the client calls is 443 and that the resulting url contains it
j
So you got me thinking. I have the server set up to use port 8080... But I dont do anything to specify to listen for WSS (I am relying on defaults). I am probably missing some sort of option.
maybe 2
Cant figure out what that might be though. I guess maybe that's a better description of my issue. I dont know how to get kotlinx-rpc the server component to listen for a WSS connection.
a
Can you please check if the regular HTTPS connection can be established? Which versions of TLS does the server support?
a
and/or certificate issues?
j
Yeah looking through everything here I feel insane for thinking this would work in the first place. I have not configured any sort of SSL in my
embeddedServer
call. I see now there's a whole setup process. Not to mention, I'll probably use a reverse proxy in the end anyway which I can use for SSL. So yeah I would chalk this up to me just not thinking very hard. I consider my question answered, there's no issues using SSL with kRPC, it just requires setup 🙂
kodee happy 1