[Libwebsockets] session reclaim on network change

andy at warmcat.com andy at warmcat.com
Mon Aug 17 15:58:22 CEST 2020

On August 17, 2020 1:52:04 PM UTC, Mirko Brankovic <mirkobrankovic at gmail.com> wrote:
>Maybe a noobish question and probably what I seek is impossible, but
>someone already know about it.
>Is it possible in any way to re-claim the ws session once user Network
>settings are changed? Like user enabling/disabling VPN or switching
>Wifi/Cable connection, so client source IP changing.
>I think because of the security reasons it is not possible, since it
>be considered as connection hijacking but maybe there can be some
>server challenge that client needs to answer correctly to re-claim?

The connection at tcp level has had it, because it's bound to specific source and destination ip addresses / ports.  Eventually the server will observe a tcp close and that's reflected in a wsi close.

But if a 'session' is some longer-lived thing in your application, you can paint the client with a random http session cookie, and understand if you see it come again it should be treated as a new ws connection to the same logical session the cookie owner was bound to on his previous connection.



More information about the Libwebsockets mailing list