简体   繁体   中英

Websocket python

Background:

  • I need to read a csv file and establish websocket connection using things from the csv file.
  • The script will check the csv file every second.
  • If a new element was added to the.csv file then the websocket will restart a new connection.
  • In the meantime, the script will continue to receive data from the server.
  • Writtend in python

example of.csv file: [1]: https://i.stack.imgur.com/drikH.png

I not sure how to receive the data continuously while checking the csv file.

maybe async? Any suggestions?

Use threading in reading and writing the csv file. When the server receives the data, store the data in a list and it will act as a queue. Inside the thread function you will restart the connection.

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