<commit_before>var Server = require('./lib/index.js').Server;
var server = new Server();

var names = {};

server.on('connection', function(connection) {
  console.log('someone connected to me');
  names[connection.id] = 'someone';
});

server.on('message','name', function(context) {
  console.log(context.message.first + ' sent me their name');
  names[context.connection.id] = context.message.first;
});

server.on('request', 'name', function(context) {
  console.log(names[context.connection.id] + ' is asking for my name');
  context.reply({ first : 'steve', last : 'johnson' });
});

server.listen({ port : 1234 }, function(err) {
  if(err) {
    console.log('problem starting the server' + err);
  }
});

var Client = require('./lib/index.js').Client;
var client = new Client();

client.connect('ws://localhost:1234', function(err, connection) {
  connection.send({ type : 'name', first : 'bob', last : 'swenson' }, function(err) {
    if(err) {
      console.log('somthing went wrong ' +  err);
    } else {
      connection.request({ type : 'name' }, function(err, replyContext) {
        console.log('the servers name is ' +  replyContext.message.first);<commit_msg>fixed tonic example<commit_after>var Server = require('wyre').Server;
var server = new Server();

var names = {};

server.on('connection', function(connection) {
  console.log('someone connected to me');
  names[connection.id] = 'someone';
});

server.on('message','name', function(context) {
  console.log(context.message.first + ' sent me their name');
  names[context.connection.id] = context.message.first;
});

server.on('request', 'name', function(context) {
  console.log(names[context.connection.id] + ' is asking for my name');
  context.reply({ first : 'steve', last : 'johnson' });
});

server.listen({ port : 1234 }, function(err) {
  if(err) {
    console.log('problem starting the server' + err);
  }
});

var Client = require('wyre').Client;
var client = new Client();

client.connect('ws://localhost:1234', function(err, connection) {
  connection.send({ type : 'name', first : 'bob', last : 'swenson' }, function(err) {
    if(err) {
      console.log('somthing went wrong ' +  err);
    } else {
      connection.request({ type : 'name' }, function(err, replyContext) {
        console.log('the servers name is ' +  replyContext.message.first);
{'fraction_non_alphanumeric': 0.18306244653550044, 'fraction_numerical': 0.006843455945252352, 'mean_word_length': 4.303854875283447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4177643', 'n_tokens_mistral': 742, 'n_tokens_neox': 719, 'n_words': 169}