public class SocketHelper.SocketWrapper
extends java.lang.Object
Constructor and Description |
---|
SocketWrapper(jdk.nashorn.api.scripting.ScriptObjectMirror eventEmitter,
java.lang.Object socket,
java.lang.String sendType,
java.lang.String receiveType,
boolean rawBytes,
boolean emitBatchDataAsAvailable)
Construct a handler for connections established.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the socket and remove all event listeners on the associated
event emitter.
|
void |
send(java.lang.Object data)
Send data over the socket.
|
public SocketWrapper(jdk.nashorn.api.scripting.ScriptObjectMirror eventEmitter, java.lang.Object socket, java.lang.String sendType, java.lang.String receiveType, boolean rawBytes, boolean emitBatchDataAsAvailable)
eventEmitter
- The JavaScript object that will emit socket
events.socket
- The Vertx socket object.sendType
- The send type.receiveType
- The receive type.rawBytes
- If true, send and received raw bytes, with no
message framing. If false, then prepend each sent item with a
length, and for received items, assume received data is prepended
with a length and emit received data only when a complete message
has arrived.emitBatchDataAsAvailable
- Whether to emit all data available when the TCP stream
is received and when rawBytes is true. This parameter is intended for socket.js module
and this SocketHelper. Thus, this parameter will not be exposed to TCP socket accessors.
Set this true only when the TCP stream is going to be handled by upper layer protocols
to avoid non-deterministic behavior.