<commit_before>require! {
	redis
	jade
	'../../config'
}

module.exports = (io) ->
	io.of '/streaming/log' .on \connection (socket) ->
		
		socket.emit \connected
		
		subscriber = redis.create-client!
		subscriber.subscribe \misskey:log
		subscriber.on \message (, log) ->
			console.log log
			log = parse-json log
			compiler = jade.compile-file switch log.type
			| \web-incoming => "#__dirname/../../web/main/views/dynamic-parts/log/web-incoming.jade"
			| \web-outgoing => "#__dirname/../../web/main/views/dynamic-parts/log/web-outgoing.jade"
			| \api-incoming => "#__dirname/../../web/main/views/dynamic-parts/log/api-incoming.jade"
			| \api-outgoing => "#__dirname/../../web/main/views/dynamic-parts/log/api-outgoing.jade"
			socket.emit \log compiler log.value
			
		socket.on \disconnect ->
			# Disconnect redis
			subscriber.quit!<commit_msg>Remove debug code<commit_after>require! {
	redis
	jade
	'../../config'
}

module.exports = (io) ->
	io.of '/streaming/log' .on \connection (socket) ->
		
		socket.emit \connected
		
		subscriber = redis.create-client!
		subscriber.subscribe \misskey:log
		subscriber.on \message (, log) ->
			log = parse-json log
			compiler = jade.compile-file switch log.type
			| \web-incoming => "#__dirname/../../web/main/views/dynamic-parts/log/web-incoming.jade"
			| \web-outgoing => "#__dirname/../../web/main/views/dynamic-parts/log/web-outgoing.jade"
			| \api-incoming => "#__dirname/../../web/main/views/dynamic-parts/log/api-incoming.jade"
			| \api-outgoing => "#__dirname/../../web/main/views/dynamic-parts/log/api-outgoing.jade"
			socket.emit \log compiler log.value
			
		socket.on \disconnect ->
			# Disconnect redis
			subscriber.quit!
{'fraction_non_alphanumeric': 0.18326458456098998, 'fraction_numerical': 0.0, 'mean_word_length': 2.8329571106094806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '1845162', 'n_tokens_mistral': 661, 'n_tokens_neox': 590, 'n_words': 91}