1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/websocket_hybi/file_binary-frames_wsh.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,18 @@ 1.4 +from mod_pywebsocket import common 1.5 +from mod_pywebsocket import stream 1.6 + 1.7 + 1.8 +def web_socket_do_extra_handshake(request): 1.9 + pass 1.10 + 1.11 + 1.12 +def web_socket_transfer_data(request): 1.13 + messages_to_send = ['Hello, world!', '', all_distinct_bytes()] 1.14 + for message in messages_to_send: 1.15 + # FIXME: Should use better API to send binary messages when pywebsocket supports it. 1.16 + header = stream.create_header(common.OPCODE_BINARY, len(message), 1, 0, 0, 0, 0) 1.17 + request.connection.write(header + message) 1.18 + 1.19 + 1.20 +def all_distinct_bytes(): 1.21 + return ''.join([chr(i) for i in xrange(256)])