receive-backpressure_wsh.py (343B)
1 #!/usr/bin/python 2 3 import time 4 5 6 def web_socket_do_extra_handshake(request): 7 # Turn off permessage-deflate, otherwise it shrinks our 8MB buffer to 8KB. 8 request.ws_extension_processors = [] 9 10 11 def web_socket_transfer_data(request): 12 # Wait two seconds to cause backpressure. 13 time.sleep(2); 14 request.ws_stream.receive_message()