<commit_before>import logging
from tornado.websocket import  WebSocketHandler
from server__client.server.models.visual_element import Visual_element

socket_logger = logging.getLogger('WS')
socket_logger.disabled = False
socket_logger.setLevel("DEBUG")

class Websocket(WebSocketHandler):

    clients = set()
    logic = None

    def open(self, ):
      
        if 'Name' in self.request.headers._dict:
            self.name = self.request.headers._dict['Name']
            Websocket.logic = self
            socket_logger.info("logic connected")
        else:
            self.name = self.get_cookie('name')
            Websocket.clients.add(self)
            socket_logger.info("client connected")


    def on_message(self, message):
        socket_logger.debug('%s send: %s',self.name, message)

        if self == Websocket.logic:
            data = message.split(',')<commit_msg>Logic is now authorised if secret string maches.<commit_after>import logging
from tornado.websocket import  WebSocketHandler
from server__client.server.models.visual_element import Visual_element

socket_logger = logging.getLogger('WS')
socket_logger.disabled = False
socket_logger.setLevel("DEBUG")

class Websocket(WebSocketHandler):

    clients = set()
    logic = None

    def open(self, ):
      
        if 'Secret' in self.request.headers._dict:
            Websocket.logic = self
            secret = self.request.headers._dict['Secret']
            if secret == '<KEY>':
                self.name = 'logic'
                socket_logger.info("logic connected")
            else:
                socket_logger.warn("Attempted unauthorized logic connection")
                self.close()
        else:
            self.name = self.get_cookie('name')
            Websocket.clients.add(self)
            socket_logger.info("client connected")


    def on_message(self, message):
        socket_logger.debug('%s send: %s',self.name, message)

        if self == Websocket.logic:
            data = message.split(',')
{'fraction_non_alphanumeric': 0.10542018896071606, 'fraction_numerical': 0.0, 'mean_word_length': 2.5673758865248226, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '663859', 'n_tokens_mistral': 574, 'n_tokens_neox': 546, 'n_words': 119}