<commit_before>import User from "./user";
import Router from "./router";

export default function Dispatcher () {

    this.user = new User();
    this.router = new Router();

    // When a websocket message is received, this method is called with the message as the sole argument. Every message
    // has a property "operation" that tells the dispatcher what to do. Illegal operation names will throw an error.
    this.handle = (message) => {
        console.log(`${message.interface}.${message.operation}`); // eslint-disable-line
    };

    this.establishConnection = () => {

        var protocol = window.location.protocol === "https:" ? "wss" : "ws";

        this.connection = new window.WebSocket(`${protocol}://${window.location.host}/ws`);

        this.connection.onmessage = (event) => {
            dispatcher.handle(JSON.parse(event.data));
        };

        this.connection.onclose = () => {
            dispatcher.emit("closed");
        };
    };
}
<commit_msg>Change websocket connection class name<commit_after>import User from "./user";
import Router from "./router";

export default function WSConnection () {

    this.user = new User();
    this.router = new Router();

    // When a websocket message is received, this method is called with the message as the sole argument. Every message
    // has a property "operation" that tells the dispatcher what to do. Illegal operation names will throw an error.
    this.handle = (message) => {
        console.log(`${message.interface}.${message.operation}`); // eslint-disable-line
    };

    this.establishConnection = () => {

        var protocol = window.location.protocol === "https:" ? "wss" : "ws";

        this.connection = new window.WebSocket(`${protocol}://${window.location.host}/ws`);

        this.connection.onmessage = (event) => {
            dispatcher.handle(JSON.parse(event.data));
        };

        this.connection.onclose = () => {
            dispatcher.emit("closed");
        };
    };
}

{'fraction_non_alphanumeric': 0.1445057701956849, 'fraction_numerical': 0.0, 'mean_word_length': 2.7271028037383176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '892730', 'n_tokens_mistral': 542, 'n_tokens_neox': 527, 'n_words': 152}