<commit_before>/* tslint:disable:no-console */
import * as readline from 'readline';
import * as WebSocket from 'ws';

import * as Interactive from '../';
import { IScene } from '../state/interfaces';
import { request } from './client';

if (process.argv.length < 6) {
    console.log('Usage participant.exe <username> <password> <url> <channelid>');
}

const rl = readline.createInterface(process.stdin, process.stdout);

Interactive.setWebSocket(WebSocket);
const auth = {
    username: process.argv[2],
    password: <PASSWORD>[3],
};

request('POST', 'users/login', auth)
.then(() => request('POST', 'jwt/authorize', {}))
.then(res => {
    const client = new Interactive.ParticipantClient();
    // client.on('message', (err: any) => console.log('<<<', err));
    // client.on('send', (err: any) => console.log('>>>', err));
    // client.on('error', (err: any) => console.log(err));
    client.open({
        jwt: res.headers.get('x-jwt'),
        url: process.argv[4] || 'wss://interactive1-dal.beam.pro/participant',
        channelID: parseInt(process.argv[5], 10) || 36241,
    });
<commit_msg>fix examples<commit_after>/* tslint:disable:no-console */
import * as readline from 'readline';
import * as WebSocket from 'ws';

import * as Interactive from '../';
import { IScene } from '../state/interfaces';
import { request } from './client';

if (process.argv.length < 6) {
    console.log('Usage participant.exe <username> <password> <url> <channelid>');
}

const rl = readline.createInterface(process.stdin, process.stdout);

Interactive.setWebSocket(WebSocket);
const auth = {
    username: process.argv[2],
    password: process.argv[3],
};

request('POST', 'users/login', auth)
.then(() => request('POST', 'jwt/authorize', {}))
.then(res => {
    const client = new Interactive.ParticipantClient();
    // client.on('message', (err: any) => console.log('<<<', err));
    // client.on('send', (err: any) => console.log('>>>', err));
    // client.on('error', (err: any) => console.log(err));
    client.open({
        jwt: res.headers.get('x-jwt'),
        url: process.argv[4] || 'wss://interactive1-dal.beam.pro/participant?channelId=0',
    });

{'fraction_non_alphanumeric': 0.20952821461609622, 'fraction_numerical': 0.008788159111933395, 'mean_word_length': 3.9496567505720823, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 28, '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': '7220068', 'n_tokens_mistral': 731, 'n_tokens_neox': 712, 'n_words': 155}