<commit_before>import tornado
from tornado import websocket
from os import path

class I2DXTopHandler(tornado.web.RequestHandler):
	def get(self):
		self.redirect('static/index.html')

class I2DXWebSocket(websocket.WebSocketHandler):
	def open(self):
		self.write_message("Ready")
		print "connection opened"

	def on_message(self, message):
		if message[0] == '1':
			self.toggle_key(message[1], True)
		elif message[0] == '0':
			self.toggle_key(message[1], False)

	def on_close(self):
		print "closed"

def serve(handler):
	clientdir = path.join(path.dirname(path.dirname(path.abspath(__file__))), 'client')
	application = tornado.web.Application([
		(r"/", I2DXTopHandler),
		(r"/ws", handler),
	], static_path=clientdir)
	application.listen(9876)<commit_msg>add TCP_NODELAY, and hope it helps :S<commit_after>import tornado
from tornado import websocket
from os import path
import socket

class I2DXTopHandler(tornado.web.RequestHandler):
	def get(self):
		self.redirect('static/index.html')

class I2DXWebSocket(websocket.WebSocketHandler):
	def open(self):
		self.write_message("Ready")
		self.stream.socket.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 0)
		print "connection opened"

	def on_message(self, message):
		if message[0] == '1':
			self.toggle_key(message[1], True)
		elif message[0] == '0':
			self.toggle_key(message[1], False)

	def on_close(self):
		print "closed"

def serve(handler):
	clientdir = path.join(path.dirname(path.dirname(path.abspath(__file__))), 'client')
	application = tornado.web.Application([
		(r"/", I2DXTopHandler),
		(r"/ws", handler),
	], static_path=clientdir)
	application.listen(9876)
{'fraction_non_alphanumeric': 0.14355528405620036, 'fraction_numerical': 0.016493585827733658, 'mean_word_length': 5.853556485355648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4778263', 'n_tokens_mistral': 617, 'n_tokens_neox': 562, 'n_words': 116}