websocket4j.server
Class WebSocket

java.lang.Object
  extended by websocket4j.AbstractWebSocket
      extended by websocket4j.server.WebSocket

public class WebSocket
extends AbstractWebSocket

Socket wrapper that implements server side of the WebSocket protocol. http://www.whatwg.org/specs/web-socket-protocol/


Constructor Summary
WebSocket(java.net.Socket socket)
          Creates new web socket ready for use.
WebSocket(java.net.Socket socket, java.lang.Integer timeout)
          Creates new web socket ready for use, if opening handshake doesn't finish in given time, socket creation will be aborted (if given time is 0, it will wait as long as needed).
 
Method Summary
 java.lang.String getRequestUri()
          Returns Request-URI part of the handshake header as specified in HTTP protocol.
 
Methods inherited from class websocket4j.AbstractWebSocket
close, getMessage, isClosed, sendMessage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocket

public WebSocket(java.net.Socket socket)
          throws java.io.IOException
Creates new web socket ready for use.

Parameters:
socket - socket to use for communication
Throws:
java.io.IOException - thrown when there is a problem with connection or protocol error

WebSocket

public WebSocket(java.net.Socket socket,
                 java.lang.Integer timeout)
          throws java.io.IOException
Creates new web socket ready for use, if opening handshake doesn't finish in given time, socket creation will be aborted (if given time is 0, it will wait as long as needed).

Parameters:
socket - socket to use for communication
timeout - maximum time for handshake in milliseconds
Throws:
java.io.IOException - thrown when there is a problem with connection or protocol error
Method Detail

getRequestUri

public java.lang.String getRequestUri()
Returns Request-URI part of the handshake header as specified in HTTP protocol. This will be null if the handshake failed before Request-URI was sent.

Returns:
Request-URI part of the handshake header.