<commit_before>import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { environment } from '../../environments/environment';
import * as io from 'socket.io-client';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';

@Injectable()
export class DroneDataService {

  private baseUrl: string;
  feed: any;

  constructor(private http: Http) {
    this.baseUrl = environment.nodeApiURL;
  }

  public createDrone(location: any): Promise<any>{
    return this.http.post(`${this.baseUrl}/create`, location)
        .map((res) => res.json())
        .toPromise();
  }

  public getDroneFeed(): Observable<any>{
    let feedObservable = new Observable((observer) => {
        this.feed = io(environment.feedURL);

        this.feed.on('SOCK_FEED_UPDATE', (data) => {
          observer.next(data);
        });

        return () => {
          this.feed.disconnect();
        }
    });

    return feedObservable;
  }<commit_msg>Use auth http service instead http service<commit_after>import { Injectable } from '@angular/core';
import { AuthHttpService } from '../auth-http/auth-http.service';
import { environment } from '../../environments/environment';
import * as io from 'socket.io-client';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/map';

@Injectable()
export class DroneDataService {

  private baseUrl: string;
  feed: any;

  constructor(private http: AuthHttpService) {
    this.baseUrl = environment.nodeApiURL;
  }

  public createDrone(location: any): Promise<any>{
    return this.http.post(`${this.baseUrl}/create`, location)
        .map((res) => res.json())
        .toPromise();
  }

  public getDroneFeed(): Observable<any>{
    let feedObservable = new Observable((observer) => {
        this.feed = io(environment.feedURL);

        this.feed.on('SOCK_FEED_UPDATE', (data) => {
          observer.next(data);
        });

        return () => {
          this.feed.disconnect();
        }
    });

    return feedObservable;
  }
{'fraction_non_alphanumeric': 0.15104166666666666, 'fraction_numerical': 0.0, 'mean_word_length': 3.1676528599605525, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '7058000', 'n_tokens_mistral': 645, 'n_tokens_neox': 629, 'n_words': 136}