<commit_before>gwt-websockets
--------------

[![Build Status](https://secure.travis-ci.org/realityforge/gwt-websockets.png?branch=master)](http://travis-ci.org/realityforge/gwt-websockets)

A simple library to provide web sockets support to GWT.

Quick Start
===========

The simplest way to use the library is to add the following dependency
into the build system. i.e.

```xml
<dependency>
   <groupId>org.realityforge.gwt.websockets</groupId>
   <artifactId>gwt-websockets</artifactId>
   <version>0.1</version>
   <scope>provided</scope>
</dependency>
```

Appendix
--------

* [Mozilla WebSockets Document](https://developer.mozilla.org/en-US/docs/WebSockets)
* [RFC6455: The WebSocket Protocol](http://tools.ietf.org/html/rfc6455)<commit_msg>Add some basic documentation<commit_after>gwt-websockets
--------------

[![Build Status](https://secure.travis-ci.org/realityforge/gwt-websockets.png?branch=master)](http://travis-ci.org/realityforge/gwt-websockets)

A simple library to provide web sockets support to GWT.

Quick Start
===========

The simplest way to use the library is to add the following dependency
into the build system. i.e.

```xml
<dependency>
   <groupId>org.realityforge.gwt.websockets</groupId>
   <artifactId>gwt-websockets</artifactId>
   <version>0.1</version>
   <scope>provided</scope>
</dependency>
```

Then you add the following snippet into the .gwt.xml file.

```xml
<module rename-to='myapp'>
  ...

  <!-- Enable the websocket library -->
  <inherits name="org.realityforge.gwt.websockets.WebSockets"/>
</module>
```

Then you can interact with the WebSocket from within the browser.

```java
final WebSocket webSocket = WebSocket.newWebSocketIfSupported();
if ( null != webSocket )
{
  webSocket.addOpenHandler( new OpenEvent.Handler()
  {
    @Override
    public void onOpenEvent( @Nonnull final OpenEvent event )
    {
      // After we have connected we can send
      webSocket.send( "Hello!" );
    }
  } );
  webSocket.addMessageHandler( new MessageEvent.Handler()
  {
    @Override
    public void onMessageEvent( @Nonnull final MessageEvent event )
    {
      // After we receive a message back we can close the socket
      webSocket.close();
    }
  } );
  webSocket.connect( "ws://localhost/ws/echo" );
}
```

This should be sufficient to put together a simple WebSocket application.

A very simple example of this code is available in the
[gwt-websockets-example](https://github.com/realityforge/gwt-websockets-example)
project.

Appendix
--------

* [Mozilla WebSockets Document](https://developer.mozilla.org/en-US/docs/WebSockets)
* [RFC6455: The WebSocket Protocol](http://tools.ietf.org/html/rfc6455)
{'fraction_non_alphanumeric': 0.1481203007518797, 'fraction_numerical': 0.007518796992481203, 'mean_word_length': 3.8825688073394495, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6355278', 'n_tokens_mistral': 897, 'n_tokens_neox': 827, 'n_words': 206}