def socketio_recv(context):
    io = context.io
    in_type = context._in_type

    while True:
        message = io.receive()

        if message:
            # Skip invalid messages
            if not isinstance(message, dict):
                context.error("bad_request",
                            "Your message needs to be JSON-formatted")
            elif in_type not in message:
                context.error("bad_request",
                            "You need a 'type' attribute in your message")
            else:
                # Call msg in context.
                newctx = context(message)

                # Switch context ?
                if newctx:
                    context = newctx

        if not io.session.connected:
            context.kill()
            return
Link with invalid align.
dataset/ETHPy150Open abourget/pyramid_socketio/pyramid_socketio/io.py/socketio_recv--crossover with--dataset/ETHPy150Open mozilla/kitsune/kitsune/sumo/tests/test_parser.py/TestWikiImageTags.test_link_align_invalid