<commit_before>#Overview

This project is an open-source Java implementation of [Socket.IO](http://socket.io/) server. Based on [Netty](http://netty.io/) server framework.
Required JDK 1.5 (or above).

Licensed under the Apache License 2.0.

### Features

* Supports 0.8+ version of [Socket.IO-client](https://github.com/LearnBoost/socket.io-client) up to latest - 0.9.5
* Supports xhr-polling transport

#Usage example

	SocketIOListener handler = new SocketIOListener() {

		@Override
		public void onMessage(SocketIOClient client, String message) {
			System.out.println("onMessage: " + message);
		}
	
		@Override
		public void onDisconnect(SocketIOClient client) {
			System.out.println("onDisconnect: " + client.getSessionId());
		}
	
		@Override
		public void onConnect(final SocketIOClient client) {
			System.out.println("onConnect: " + client.getSessionId());
		}

		@Override
		public void onJsonObject(SocketIOClient client, Object obj) {
			System.out.println("onJsonObject: " + obj);
		}
	};

	SocketIOServer server = new SocketIOServer();
	server.setHostname("localhost");
	server.setPort(81);
	server.setHeartbeatThreadPoolSize(8);
	server.setWorkerThreadPoolSize(8);
	server.setBossThreadPoolSize(4);
	server.setListener(handler);
	server.start();

	...
	
	server.stop();<commit_msg>Usage example improvements<commit_after>#Overview

This project is an open-source Java implementation of [Socket.IO](http://socket.io/) server. Based on [Netty](http://netty.io/) server framework.
Required JDK 1.5 (or above).

Licensed under the Apache License 2.0.

### Features

* Supports 0.8+ version of [Socket.IO-client](https://github.com/LearnBoost/socket.io-client) up to latest - 0.9.5
* Supports xhr-polling transport

#Usage example

##Server

	SocketIOListener handler = new SocketIOListener() {

		@Override
		public void onMessage(SocketIOClient client, String message) {
			...
		}
	
		@Override
		public void onDisconnect(SocketIOClient client) {
			...
		}
	
		@Override
		public void onConnect(final SocketIOClient client) {
			...
		}

		@Override
		public void onJsonObject(SocketIOClient client, Object obj) {
			...
                        SampleObject obj = new SampleObject();
                        // send object to socket.io client
                        client.sendJsonObject(obj);
		}
	};

	SocketIOServer server = new SocketIOServer();
	server.setHostname("localhost");
	server.setPort(81);
	server.setHeartbeatThreadPoolSize(8);
	server.setWorkerThreadPoolSize(8);
	server.setBossThreadPoolSize(4);
	server.setListener(handler);
	server.start();

	...
	
	server.stop();

##Client

        <script type="text/javascript" src="socket.io.js" charset="utf-8"></script>

        <script type="text/javascript">
               var socket = io.connect('http://localhost:81', {
                 'transports' : [ 'xhr-polling' ],
                 'reconnection delay' : 2000,
                 'force new connection' : true
               });
               socket.on('message', function(data) {
                    // here is your handler on messages from server
               });

               // send json-object to server
               var obj = ...
               socket.json.send(obj);
        </script>
{'fraction_non_alphanumeric': 0.12511584800741427, 'fraction_numerical': 0.010812480691998765, 'mean_word_length': 2.948780487804878, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1230041', 'n_tokens_mistral': 1041, 'n_tokens_neox': 950, 'n_words': 223}