com.koushikdutta.async.http
Class WebSocketImpl

java.lang.Object
  extended by com.koushikdutta.async.http.WebSocketImpl
All Implemented Interfaces:
AsyncSocket, DataEmitter, DataSink, WebSocket

public class WebSocketImpl
extends java.lang.Object
implements WebSocket


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.koushikdutta.async.http.WebSocket
WebSocket.StringCallback
 
Constructor Summary
WebSocketImpl(AsyncHttpServerRequest request, AsyncHttpServerResponse response)
           
WebSocketImpl(AsyncSocket socket)
           
 
Method Summary
static void addWebSocketUpgradeHeaders(AsyncHttpRequest req, java.lang.String protocol)
           
 void close()
           
 void end()
           
static WebSocket finishHandshake(RawHeaders requestHeaders, AsyncHttpResponse response)
           
 CompletedCallback getClosedCallback()
           
 DataCallback getDataCallback()
           
 CompletedCallback getEndCallback()
           
 AsyncServer getServer()
           
 AsyncSocket getSocket()
           
 WebSocket.StringCallback getStringCallback()
           
 WritableCallback getWriteableCallback()
           
 boolean isBuffering()
           
 boolean isChunked()
           
 boolean isOpen()
           
 boolean isPaused()
           
 void pause()
           
 void resume()
           
 void send(byte[] bytes)
           
 void send(java.lang.String string)
           
 void setClosedCallback(CompletedCallback handler)
           
 void setDataCallback(DataCallback callback)
           
 void setEndCallback(CompletedCallback callback)
           
 void setStringCallback(WebSocket.StringCallback callback)
           
 void setWriteableCallback(WritableCallback handler)
           
 void write(java.nio.ByteBuffer bb)
           
 void write(ByteBufferList bb)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketImpl

public WebSocketImpl(AsyncHttpServerRequest request,
                     AsyncHttpServerResponse response)

WebSocketImpl

public WebSocketImpl(AsyncSocket socket)
Method Detail

end

public void end()
Specified by:
end in interface DataSink

addWebSocketUpgradeHeaders

public static void addWebSocketUpgradeHeaders(AsyncHttpRequest req,
                                              java.lang.String protocol)

finishHandshake

public static WebSocket finishHandshake(RawHeaders requestHeaders,
                                        AsyncHttpResponse response)

close

public void close()
Specified by:
close in interface DataEmitter
Specified by:
close in interface DataSink

setClosedCallback

public void setClosedCallback(CompletedCallback handler)
Specified by:
setClosedCallback in interface DataSink

getClosedCallback

public CompletedCallback getClosedCallback()
Specified by:
getClosedCallback in interface DataSink

setEndCallback

public void setEndCallback(CompletedCallback callback)
Specified by:
setEndCallback in interface DataEmitter

getEndCallback

public CompletedCallback getEndCallback()
Specified by:
getEndCallback in interface DataEmitter

send

public void send(byte[] bytes)
Specified by:
send in interface WebSocket

send

public void send(java.lang.String string)
Specified by:
send in interface WebSocket

setStringCallback

public void setStringCallback(WebSocket.StringCallback callback)
Specified by:
setStringCallback in interface WebSocket

setDataCallback

public void setDataCallback(DataCallback callback)
Specified by:
setDataCallback in interface DataEmitter

getStringCallback

public WebSocket.StringCallback getStringCallback()
Specified by:
getStringCallback in interface WebSocket

getDataCallback

public DataCallback getDataCallback()
Specified by:
getDataCallback in interface DataEmitter

isOpen

public boolean isOpen()
Specified by:
isOpen in interface DataSink

isBuffering

public boolean isBuffering()
Specified by:
isBuffering in interface WebSocket

write

public void write(java.nio.ByteBuffer bb)
Specified by:
write in interface DataSink

write

public void write(ByteBufferList bb)
Specified by:
write in interface DataSink

setWriteableCallback

public void setWriteableCallback(WritableCallback handler)
Specified by:
setWriteableCallback in interface DataSink

getWriteableCallback

public WritableCallback getWriteableCallback()
Specified by:
getWriteableCallback in interface DataSink

getSocket

public AsyncSocket getSocket()
Specified by:
getSocket in interface WebSocket

getServer

public AsyncServer getServer()
Specified by:
getServer in interface AsyncSocket
Specified by:
getServer in interface DataEmitter
Specified by:
getServer in interface DataSink

isChunked

public boolean isChunked()
Specified by:
isChunked in interface DataEmitter

pause

public void pause()
Specified by:
pause in interface DataEmitter

resume

public void resume()
Specified by:
resume in interface DataEmitter

isPaused

public boolean isPaused()
Specified by:
isPaused in interface DataEmitter