Next: , Previous: Top, Up: Top

1 WebSocket

This chapter describes WebSocket protocol and it's GNU WebSocket4J implementation.

WebSocket protocol

WebSocket is a protocol that provides bi-directional communication over a TCP socket, designed to be implemented in web browsers for use in HTML5 applications. While main use of this protocol is to allow a stable communication channel between a web server and JavaScript running in a web browser the protocol can be used by any application.

JavaScript WebSocket API is being standardised by W3C (latest draft can be obtained from <>). WebSocket protocol is being standardised by the IETF. Latest standard can be downloaded from <>.

GNU WebSocket4J implementation

GNU WebSocket4J is an implementation of WebSocket protocol in Java. GNU WebSocket4J tries to provide a simple API for both client and server sockets that would be as easy to use, as the WebSocket JavaScript API, or TCP sockets in Java standard library.

See Accepting connections, if you want to create a WebSocket server application.

See Connecting to server, if you want to create a WebSocket client application talking to a WebSocket server.