<commit_before>/// <reference path="ws.d.ts" />

import WebSocket = require('ws');
import http = require('http');
// import * as http from 'http'

var WebSocketServer = WebSocket.Server;

{
    var ws = new WebSocket('ws://www.host.com/path');
    ws.on('open', () => ws.send('something'));
    ws.on('message', (data, flags) => {});
}

{
    var ws = new WebSocket('ws://www.host.com/path');
    ws.on('open', () => {
        var array = new Float32Array(5);
        for (var i = 0; i < array.length; ++i) array[i] = i / 2;
        ws.send(array, {binary: true, mask: true});
    });
}

{
    var wss = new WebSocketServer({port: 8080});
    wss.on('connection', (ws) => {
        ws.on('message', (message) => console.log('received: %s', message));
        ws.send('something');
    });
}

{
    var wss = new WebSocketServer({port: 8080});

    const broadcast = function(data: any) {
        for(var i in wss.clients)
            wss.clients[i].send(data);
    };
}

{
    var wsc = new WebSocket('ws://echo.websocket.org/', {
        protocolVersion: 8,
        origin: 'http://websocket.org'
    });

    wsc.on('open',  () => wsc.send(Date.now().toString(), {mask: true}));
    wsc.on('close', () => console.log('disconnected'));

    wsc.on('message', (data, flags) => {
        console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);
        setTimeout(() => {
            wsc.send(Date.now().toString(), {mask: true});
        }, 500);
    });
}

{
    <commit_msg>work with --target es6<commit_after>/// <reference path="ws.d.ts" />

import * as WebSocket from 'ws';
import * as http from'http';

var WebSocketServer = WebSocket.Server;

{
    var ws = new WebSocket('ws://www.host.com/path');
    ws.on('open', () => ws.send('something'));
    ws.on('message', (data, flags) => {});
}

{
    var ws = new WebSocket('ws://www.host.com/path');
    ws.on('open', () => {
        var array = new Float32Array(5);
        for (var i = 0; i < array.length; ++i) array[i] = i / 2;
        ws.send(array, {binary: true, mask: true});
    });
}

{
    var wss = new WebSocketServer({port: 8080});
    wss.on('connection', (ws) => {
        ws.on('message', (message) => console.log('received: %s', message));
        ws.send('something');
    });
}

{
    var wss = new WebSocketServer({port: 8080});

    const broadcast = function(data: any) {
        for(var i in wss.clients)
            wss.clients[i].send(data);
    };
}

{
    var wsc = new WebSocket('ws://echo.websocket.org/', {
        protocolVersion: 8,
        origin: 'http://websocket.org'
    });

    wsc.on('open',  () => wsc.send(Date.now().toString(), {mask: true}));
    wsc.on('close', () => console.log('disconnected'));

    wsc.on('message', (data, flags) => {
        console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags);
        setTimeout(() => {
            wsc.send(Date.now().toString(), {mask: true});
        }, 500);
    });
}

{
{'fraction_non_alphanumeric': 0.2209106239460371, 'fraction_numerical': 0.011804384485666104, 'mean_word_length': 2.577804583835947, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '7436847', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1035, 'n_words': 211}