Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.14k stars 381 forks source link

Allow server termination when running in forever mode #23

Closed ankitmcgill closed 2 years ago

ankitmcgill commented 7 years ago

Provide method to let user program to terminate websocket server when the socket server is executing run_forever() function.

kirkatexo commented 6 years ago

This seems to conflict with traditional usage of run_forever() as a blocking listen-initialization. What if there was 1) an alternative "run_threaded()" method (see #30 ) and 2) a "terminate()" method for those cases?

mithom commented 5 years ago

i agree here, there should be a possibility for gracefull shutdown, quitting the server either from in a callback function or from outside in cuse you use threaded. No need to forsee a run_threaded() function here as the Threading module is exactly meant for this and it would only complicate stuff to prevent 2 lines of code.

Pithikos commented 2 years ago

This is now supported with v0.5.4