def classWebSocket(): """ Websocket for the list of instances of the classes Game, Player and Tournament -> used to get the a json with the list of instances of theses classes """ # should be a websocket wsock = request.environ.get('wsgi.websocket') if not wsock: abort(400, 'Expected Websocket request.') # register this websocket BaseClass.registerLoIWebSocket(wsock) # send to this websocket BaseClass.sendListofInstances(wsock) # loop until the end of this websocket while True: try: wsock.receive() except WebSocketError: BaseClass.removeLoIWebSocket(wsock) break