You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this library on a server with multiple public IP addresses and I need to be able to specify an exact IP address for websockets library to use. I checked library codes and found where it calls the connect function of websockets library:
Client manages reconnects automatically, I guess socket object can't be re-used upon reconnections and should be allocated from scratch each time? Did you look at it? Probably this can only be solved by a custom callback function which will be called before each connection attempt.
@FZambia You're right, I didn't consider the reconnection mechanism.
I've tested library for many hours and sometimes websocket connection is lost due to network errors or server-side problems, but library gets stuck at reconnecting. I tried to figure out why that happened by reading debug logs but no luck, so I had no other option but to set _need_reconnect attribute to False and manage reconnection by myself (typically by stopping current tasks, instantiating a new Client object and so on). Perhaps that's why I didn't notice the problem you just described.
So I think other people who rely on the library internal reconnection mechanism, should re-initialize the socket object in on_connecting callback.
Hi,
I'm using this library on a server with multiple public IP addresses and I need to be able to specify an exact IP address for
websockets
library to use. I checked library codes and found where it calls theconnect
function ofwebsockets
library:To specify a certain IP address for
websockets
library, I need to passsock
parameter to thewebsockets.connect
function, like this:So if it's possible, please add a
sock
argument toClient
class and then pass it towebsockets.connect
function in_create_connection
function.Thanks for developing this library.
The text was updated successfully, but these errors were encountered: