<commit_before>import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';
import 'rxjs/add/operator/share';
import io from 'socket.io-client';

export function SocketIOClientSubject(config){
  var connectURL = config.url;
  var socket = io(connectURL);

  var subscriber = Subscriber.create(function(eventName, data){
      socket.emit(eventName, data);
  });

  var observable = Observable.create((obs) => {
    socket.on('connect', function(){
      subscriber.next(socket);
    })
  }).share();

  return Subject.create(subscriber, observable);
}
<commit_msg>more beef<commit_after>import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';
import io from 'socket.io-client';

export function SocketIOClientSubject(config){
  var connectURL = config.url;
  var socket = io(connectURL);

  var connectionObserver = Subscriber.create(
    function(data){
      socket.emit(data);
    },
    function(){},
    function(){}
  );

  var observable = Observable.create(function(subscriber){
    socket.on('connect', function(){
      console.log("connected!", socket);
      subscriber.next(socket);
    })

    return function(){
      socket.close();
    }
  });

  return Subject.create(connectionObserver, observable);
}

{'fraction_non_alphanumeric': 0.14380530973451328, 'fraction_numerical': 0.0, 'mean_word_length': 4.363636363636363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2461344', 'n_tokens_mistral': 412, 'n_tokens_neox': 399, 'n_words': 90}