| OLD | NEW |
| 1 # Copyright 2009, Google Inc. | 1 # Copyright 2009, Google Inc. |
| 2 # All rights reserved. | 2 # All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 # notify to client that message is received by server. | 49 # notify to client that message is received by server. |
| 50 msgutil.send_message(request, message) | 50 msgutil.send_message(request, message) |
| 51 msgutil.receive_message(request) # wait, and exception by close. | 51 msgutil.receive_message(request) # wait, and exception by close. |
| 52 dataToBroadcast["message"] = message | 52 dataToBroadcast["message"] = message |
| 53 dataToBroadcast["closeCode"] = str(request.ws_close_code) | 53 dataToBroadcast["closeCode"] = str(request.ws_close_code) |
| 54 finally: | 54 finally: |
| 55 # request is closed. notify this dataToBroadcast to other WebSockets. | 55 # request is closed. notify this dataToBroadcast to other WebSockets. |
| 56 del connections[request] | 56 del connections[request] |
| 57 for ws in connections.keys(): | 57 for ws in connections.keys(): |
| 58 msgutil.send_message(ws, json.dumps(dataToBroadcast)) | 58 msgutil.send_message(ws, json.dumps(dataToBroadcast)) |
| OLD | NEW |