websocket4j.client
Class WebSocket
java.lang.Object
websocket4j.AbstractWebSocket
websocket4j.client.WebSocket
public class WebSocket
- extends AbstractWebSocket
Socket wrapper that implements client side of the WebSocket protocol.
http://www.whatwg.org/specs/web-socket-protocol/
Constructor Summary |
WebSocket(java.lang.String host,
java.lang.Integer port,
java.lang.String requestUri)
Creates new web socket connected to given host and port, requesting given
URI. |
WebSocket(java.lang.String host,
java.lang.Integer port,
java.lang.String requestUri,
java.lang.Integer timeout)
Creates new web socket connected to given host and port, requesting given
URI. |
Method Summary |
protected void |
handshake(java.lang.Object... args)
Performs an opening handshake with the server. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebSocket
public WebSocket(java.lang.String host,
java.lang.Integer port,
java.lang.String requestUri,
java.lang.Integer timeout)
throws java.io.IOException
- Creates new web socket connected to given host and port, requesting given
URI.
- Parameters:
host
- server host nameport
- server port numberrequestUri
- URI to requesttimeout
- number of milliseconds that the opening handshake can take
before being cancelled (if 0 then it will block forever)
- Throws:
java.io.IOException
- thrown when there is a problem with connection or protocol
error
WebSocket
public WebSocket(java.lang.String host,
java.lang.Integer port,
java.lang.String requestUri)
throws java.io.IOException
- Creates new web socket connected to given host and port, requesting given
URI. This will block untill there is response from the other party.
- Parameters:
host
- server host nameport
- server port numberrequestUri
- URI to request
- Throws:
java.io.IOException
- thrown when there is a problem with connection or protocol
error
handshake
protected void handshake(java.lang.Object... args)
throws java.io.IOException,
java.security.NoSuchAlgorithmException
- Performs an opening handshake with the server. If this method completes
successfully, a connection with the server is established.
- Specified by:
handshake
in class AbstractWebSocket
- Parameters:
args
- this should be String host, Integer port, String requestUri
- Throws:
java.io.IOException
- thrown when there is a problem in socket communication or
server does not follow the handshake protocol
java.security.NoSuchAlgorithmException
- thrown when JVM doesn't support MD5 algorithm