public abstract class BaseServerTransport extends Object implements ServerTransport
ServerTransport
.Modifier and Type | Field and Description |
---|---|
protected Actions<ByteBuffer> |
binaryActions |
protected Actions<Void> |
closeActions |
protected Actions<Throwable> |
errorActions |
protected Actions<String> |
textActions |
Constructor and Description |
---|
BaseServerTransport() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
protected abstract void |
doClose() |
protected abstract void |
doSend(ByteBuffer data) |
protected abstract void |
doSend(String data) |
ServerTransport |
onbinary(Action<ByteBuffer> action)
Attaches an action for the binary message.
|
ServerTransport |
onclose(Action<Void> action)
Attaches an action for the close event.
|
ServerTransport |
onerror(Action<Throwable> action)
Executed if there was any error on the connection.
|
ServerTransport |
ontext(Action<String> action)
Attaches an action for the text message.
|
ServerTransport |
send(ByteBuffer data)
Sends a binary message through the connection.
|
BaseServerTransport |
send(String data)
Sends a text message through the connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
unwrap, uri
protected Actions<ByteBuffer> binaryActions
public ServerTransport ontext(Action<String> action)
ServerTransport
ontext
in interface ServerTransport
public ServerTransport onbinary(Action<ByteBuffer> action)
ServerTransport
onbinary
in interface ServerTransport
public BaseServerTransport send(String data)
ServerTransport
send
in interface ServerTransport
public ServerTransport send(ByteBuffer data)
ServerTransport
send
in interface ServerTransport
protected abstract void doSend(String data)
protected abstract void doSend(ByteBuffer data)
public ServerTransport onerror(Action<Throwable> action)
ServerTransport
onerror
in interface ServerTransport
public ServerTransport onclose(Action<Void> action)
ServerTransport
onclose
in interface ServerTransport
public void close()
ServerTransport
close
in interface ServerTransport
protected abstract void doClose()
Copyright 2015, The Cettia Project