<commit_before>##libpomelo

libpomelo is a C language client SDK for Pomelo, supporting the Pomelo
protocol definition in Pomelo 0.3 version.

 * Homepage: <http://pomelo.netease.com/>
 * Mailing list: <https://groups.google.com/group/pomelo>
 * Documentation: <http://github.com/NetEase/pomelo>
 * Wiki: <https://github.com/NetEase/pomelo/wiki/>
 * Issues: <https://github.com/NetEase/pomelo/issues/>
 * Tags: game, nodejs

##Dependencies

* [libuv](https://github.com/joyent/libuv) - Cross platform layer, mainly using Network IO and thread.
* [jansson](https://github.com/akheron/jansson) - JSON encode and decode library.

##Usage

###Create a client instance

``` c
// create a client instance.
pc_client_t *client = pc_client_new();
  
```

###Add listeners

``` c
  // add some event callback.
  pc_add_listener(client, "onHey", on_hey);
  pc_add_listener(client, PC_EVENT_DISCONNECT, on_close);
```

###Listener definition

``` c
// disconnect event callback.
void on_close(pc_client_t *client, const char *event, void *data) {
  printf("client closed: %d.\n", client->state);
}
```

###Connect to server

``` c
  struct sockaddr_in address;

  memset(&address, 0, sizeof(struct sockaddr_in));
  address.sin_family = AF_INET;
  address.sin_port = htons(port);
  address.sin_addr.s_addr = inet_addr(ip);

  // try to connect to server.
  if(pc_client_connect(client, &address)) {
    printf("fail to connect server.\n");
    pc_client_destroy(client);
    return 1;
  }
 ```

###Send a notify
 
 ``` c
// notified callback
void on_notified(pc_notify_t *req, int status) {
  if(status == -1) {
    printf("Fail to send notify to server.\n");
  } else {
    printf("Notify finished.\n");
  }
<commit_msg>update README timeout listener<commit_after>##libpomelo

libpomelo is a C language client SDK for Pomelo, supporting the Pomelo
protocol definition in Pomelo 0.3 version.

 * Homepage: <http://pomelo.netease.com/>
 * Mailing list: <https://groups.google.com/group/pomelo>
 * Documentation: <http://github.com/NetEase/pomelo>
 * Wiki: <https://github.com/NetEase/pomelo/wiki/>
 * Issues: <https://github.com/NetEase/pomelo/issues/>
 * Tags: game, nodejs

##Dependencies

* [libuv](https://github.com/joyent/libuv) - Cross platform layer, mainly using Network IO and thread.
* [jansson](https://github.com/akheron/jansson) - JSON encode and decode library.

##Usage

###Create a client instance

``` c
// create a client instance.
pc_client_t *client = pc_client_new();
  
```

###Add listeners

``` c
  // add some event callback.
  pc_add_listener(client, "onHey", on_hey);
  pc_add_listener(client, PC_EVENT_DISCONNECT, on_close);
```

###Listener definition

``` c
// disconnect event callback.
void on_close(pc_client_t *client, const char *event, void *data) {
  printf("client closed: %d.\n", client->state);
}
```

###Pomelo defined listeners
```
#define PC_EVENT_DISCONNECT "disconnect"
#define PC_EVENT_TIMEOUT "timeout"
#define PC_EVENT_KICK "onKick"
```

###Connect to server

``` c
  struct sockaddr_in address;

  memset(&address, 0, sizeof(struct sockaddr_in));
  address.sin_family = AF_INET;
  address.sin_port = htons(port);
  address.sin_addr.s_addr = inet_addr(ip);

  // try to connect to server.
  if(pc_client_connect(client, &address)) {
    printf("fail to connect server.\n");
    pc_client_destroy(client);
    return 1;
  }
 ```

###Send a notify
 
 ``` c
// notified callback
void on_notified(pc_notify_t *req, int status) {
  if(status == -1) {
    printf("Fail to send notify to server.\n");
  } else {
    printf("Notify finished.\n");
  }

{'fraction_non_alphanumeric': 0.15088013411567477, 'fraction_numerical': 0.002794076557697681, 'mean_word_length': 4.151079136690647, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 10, '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': '6972583', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1232, 'n_words': 309}