<commit_before>class SocketIORemoteEndpoint

  initialize: ([options]..., callback=->) ->
    options ?= {}
    @_sockets = []

    if options.ioInstance
      @_io = options.ioInstance
    else
      @_io = require('socket.io')()
      listen = true

    @_io.sockets.on 'connection', (socket) =>
      @_sockets.push socket
      socket.on 'RPC_Request', (RPC_Request) =>
        @_handleRPCRequest RPC_Request, (err, response) =>
          rpcId = RPC_Request.rpcId
          socket.emit 'RPC_Response', {rpcId: rpcId, err: err, data: response}

    if listen
      @_io.listen 3000
      callback()


  close: ->
    @_io.engine.close()


  setRPCHandler: (@_handleRPCRequest) ->



module.exports = new SocketIORemoteEndpoint<commit_msg>Fix callback on initialize<commit_after>class SocketIORemoteEndpoint

  initialize: ([options]..., callback=->) ->
    options ?= {}
    @_sockets = []

    if options.ioInstance
      @_io = options.ioInstance
    else
      @_io = require('socket.io')()
      listen = true

    @_io.sockets.on 'connection', (socket) =>
      @_sockets.push socket
      socket.on 'RPC_Request', (RPC_Request) =>
        @_handleRPCRequest RPC_Request, (err, response) =>
          rpcId = RPC_Request.rpcId
          socket.emit 'RPC_Response', {rpcId: rpcId, err: err, data: response}

    if listen
      @_io.listen 3000

    callback()


  close: ->
    @_io.engine.close()


  setRPCHandler: (@_handleRPCRequest) ->



module.exports = new SocketIORemoteEndpoint
{'fraction_non_alphanumeric': 0.1323529411764706, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 2.733167082294264, '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': '468586', 'n_tokens_mistral': 515, 'n_tokens_neox': 485, 'n_words': 102}