简体   繁体   中英

How many attempts do websocket-client's send() do?

I use the Python package websocket-client to take care some client-server discussion.

Assume I do the following:

import websocket
MAX_TIMEOUT = 1 * 60  # Maximum time to wait to establish the connection to the server.
ws = websocket.create_connection("ws://128.52.195.211:8080/websocket")
ws.settimeout(MAX_TIMEOUT)
ws.send("Hello, World!")

How many attempts will ws.send() do to try to send the message to the server? Only 1?

If you look at the library source code , it clearly shows that there's no retry implemented.

ws.send creates frames (chunks) from the payload, and then sends each frame 1 by one in ws.send_frame

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM