<commit_before>'use strict'

class nccWebui.Models.ConnectionModel extends Backbone.Model
    initialize: (options) ->
        _.extend(@, options)
        console.log "connecting to #{@url}"
        @socket = Primus.connect @url
        @socket.on 'open', ->
            console.log 'connected to relay'
        @socket.on 'data', (data) =>
            return if @socket.reserved(data.args[0])
            console.log 'got message', data.args
            @socket.emit.apply @socket, data.args
        @socket.on 'please identify', =>
            @emit 'i am a web browser', @token, {}
        @socket.on 'a wild device appears', (device, data) =>
            @devices.add(_.extend(device, data))
        @socket.on 'a wild device disconnected', (device) =>
            @devices.remove(device)

    emit: =>
        args = Array.prototype.slice.call(arguments, 0)
        console.log 'sent message', args
        @socket.write({args:args})<commit_msg>my tabs!<commit_after>'use strict'

class nccWebui.Models.ConnectionModel extends Backbone.Model
  initialize: (options) ->
    _.extend(@, options)
    @socket = Primus.connect @url
    @socket.on 'open', ->
      console.log 'connected to relay'
    @socket.on 'data', (data) =>
      return if @socket.reserved(data.args[0])
      console.log 'got message', data.args
      @socket.emit.apply @socket, data.args
    @socket.on 'please identify', =>
      @emit 'i am a web browser', @token, {}
    @socket.on 'a wild device appears', (device, data) =>
      @devices.add(_.extend(device, data))
    @socket.on 'a wild device disconnected', (device) =>
      @devices.remove(device)

  emit: =>
    args = Array.prototype.slice.call(arguments, 0)
    console.log 'sent message', args
    @socket.write({args:args})
{'fraction_non_alphanumeric': 0.14714204867006225, 'fraction_numerical': 0.0022637238256932655, 'mean_word_length': 2.645360824742268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6595700', 'n_tokens_mistral': 535, 'n_tokens_neox': 523, 'n_words': 138}