<commit_before>"use strict"
session_store = require("./session_store")
config = require("./config")
cookie = require('cookie')
connect = require("connect")
# http://howtonode.org/socket-io-auth
randomIntBetween = (min,max)->
  return Math.floor(Math.random()*(max-min+1)+min)

module.exports = (io) ->

  io.configure ->
    io.set('log level', config.socketio.log_level)

    io.set "authorization", (handshakeData, accept) ->

      # Check whether cookies were passed
      return accept("No cookie transmitted.", false) unless handshakeData.headers.cookie

      handshakeData.cookie = cookie.parse(handshakeData.headers.cookie)
      sid = connect.utils.parseSignedCookie(handshakeData.cookie['connect.sid'], config.secret);
      handshakeData.sessionID = sid

      # unchanged if something went wrong:
      if (handshakeData.cookie['connect.sid'] == sid)
        return accept('Cookie is invalid.', false);

      console.log('SID:')
      console.log(sid)
<commit_msg>change sockets for heroku<commit_after>"use strict"
session_store = require("./session_store")
config = require("./config")
cookie = require('cookie')
connect = require("connect")
# http://howtonode.org/socket-io-auth
randomIntBetween = (min,max)->
  return Math.floor(Math.random()*(max-min+1)+min)

module.exports = (io) ->
  io.configure ->
    io.set('log level', config.socketio.log_level)
    io.set("transports", ["xhr-polling"]); 
    io.set("polling duration", 10); 
    io.set "authorization", (handshakeData, accept) ->

      # Check whether cookies were passed
      return accept("No cookie transmitted.", false) unless handshakeData.headers.cookie

      handshakeData.cookie = cookie.parse(handshakeData.headers.cookie)
      sid = connect.utils.parseSignedCookie(handshakeData.cookie['connect.sid'], config.secret);
      handshakeData.sessionID = sid

      # unchanged if something went wrong:
      if (handshakeData.cookie['connect.sid'] == sid)
        return accept('Cookie is invalid.', false);

      console.log('SID:')
      console.log(sid)

{'fraction_non_alphanumeric': 0.14704445530043966, 'fraction_numerical': 0.0019540791402051783, 'mean_word_length': 3.9468599033816427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3070836', 'n_tokens_mistral': 617, 'n_tokens_neox': 593, 'n_words': 126}