<commit_before>
from homebrain import Agent, Dispatcher, Event
from websocket_server import WebsocketServer
import threading
import logging
import json


class WebSocket(Agent):
    def __init__(self):
        super(WebSocket, self).__init__()
        self.target = self.identifier
        self.server = WebsocketServer(5601)
        self.wsThread = threading.Thread(target=self.server.run_forever)
        self.clients = self.server.clients
        self.subscriptions = []

        @self.server.set_fn_new_client
        def new_client(client, server):
            client["subscriptions"] = []

        @self.server.set_fn_client_left
        def client_left(client, server):
            logging.info("Client(%d) disconnected" % client['id'])

        @self.server.set_fn_message_received
        def message_received(client, server, msg):
            if msg:
                try:
                    event = json.loads(msg)
                    event_type = event["type"]<commit_msg>Fixed websocket server bind to 0.0.0.0<commit_after>
from homebrain import Agent, Dispatcher, Event
from websocket_server import WebsocketServer
import threading
import logging
import json


class WebSocket(Agent):
    def __init__(self):
        super(WebSocket, self).__init__()
        self.target = self.identifier
        self.server = WebsocketServer(5601, "0.0.0.0")
        self.wsThread = threading.Thread(target=self.server.run_forever)
        self.clients = self.server.clients
        self.subscriptions = []

        @self.server.set_fn_new_client
        def new_client(client, server):
            client["subscriptions"] = []

        @self.server.set_fn_client_left
        def client_left(client, server):
            logging.info("Client(%d) disconnected" % client['id'])

        @self.server.set_fn_message_received
        def message_received(client, server, msg):
            if msg:
                try:
                    event = json.loads(msg)
                    event_type = event["type"]
{'fraction_non_alphanumeric': 0.09730538922155689, 'fraction_numerical': 0.007984031936127744, 'mean_word_length': 2.46286701208981, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '353874', 'n_tokens_mistral': 587, 'n_tokens_neox': 559, 'n_words': 117}