WebSocket-for-Python icon indicating copy to clipboard operation
WebSocket-for-Python copied to clipboard

Fix for #226.

Open emmawillemsma opened this issue 8 years ago • 1 comments

Currently the client init uses only the first address info tuple returned from socket.getaddrinfo() to create the socket (see line 97). Unfortunately sometimes this isn't the right address. Best practice is to iterate through the address info tuples until we find one that we can connect to successfully. See this stack overflow question. This change necessitated moving the call to socket.connect out of the WebSocketBaseClient.connect method and into the WebSocketBaseClient.init method. If that is not desirable, we could instead pass the list of address information into the connect method and let the initialization of the socket happen there.

emmawillemsma avatar Aug 17 '17 01:08 emmawillemsma

The unit tests don't seem to be set up to allow connecting to the socket in the init. Need to investigate further.

emmawillemsma avatar Aug 17 '17 15:08 emmawillemsma