tqwewe / leptos_server_signal

Leptos server signals synced through websockets
MIT License
60 stars 12 forks source link

Added a retry timeout. #19

Open Netzeband opened 4 days ago

Netzeband commented 4 days ago

In this PR a retry timeout is added.

There is a new function provide_websocket_with_retry(...) which takes as second argument the number of milliseconds after which it tries to reconnect again. In this function, after creating the websocket object, it checks if the websocket has really been created and then adds an error handler to the websocket, which activates a timeout.

After the timeout has exceeded a new inner websocket is created, which inherits all settings from the old inner websocket, including all handlers like the message an error handler. In case the new websocket cannot connect, the error handler is invoked again and activates another timeout.

tqwewe commented 3 days ago

Thanks! I'll check it out soon