OLD | NEW |
1 from mod_pywebsocket import handshake | 1 from mod_pywebsocket import handshake |
2 from mod_pywebsocket import msgutil | 2 from mod_pywebsocket import msgutil |
3 | 3 |
4 | 4 |
5 def web_socket_do_extra_handshake(request): | 5 def web_socket_do_extra_handshake(request): |
6 pass | 6 pass |
7 | 7 |
8 | 8 |
9 def web_socket_transfer_data(request): | 9 def web_socket_transfer_data(request): |
10 # Send three messages, and then wait for three messages. | 10 # Send three messages, and then wait for three messages. |
11 msgutil.send_message(request, '1') | 11 msgutil.send_message(request, '1') |
12 msgutil.send_message(request, '2') | 12 msgutil.send_message(request, '2') |
13 msgutil.send_message(request, '3') | 13 msgutil.send_message(request, '3') |
14 | 14 |
15 for expected in (u'1', u'2', u'3'): | 15 for expected in (u'1', u'2', u'3'): |
16 message = msgutil.receive_message(request) | 16 message = msgutil.receive_message(request) |
17 if type(message) != unicode or message != expected: | 17 if type(message) != unicode or message != expected: |
18 raise handshake.AbortedByUserException('Abort the connection') | 18 raise handshake.AbortedByUserException('Abort the connection') |
OLD | NEW |