API¶
Table of Contents
EngineIoServer¶
The EngineIoServer class contains the logic for accepting and handling
connections from the client.
Methods¶
handleRequest¶
Call this method to handle an incoming HTTP request.
handleWebSocket¶
Call this method to handle an incoming WebSocket request.
Events¶
EngineIoServer emits the following events:
connection¶
This event is emitted when a new client successfully connects to the server.
Arguments
- EngineIoSocketobject
EngineIoSocket¶
The EngineIoSocket class represents one connection to a remote client.
Methods¶
Events¶
EngineIoSocket emits the following events:
open¶
This event is emitted when a connection is established.
Note This event cannot be trapped as it occurs before the “connection” event of EngineIoServer.
close¶
This event is emitted when the socket is closed either by the server or the client.
Arguments
- Stringindicating reason for close
- Stringindicating description of reason or- null
packet¶
This event is emitted when a packet is received from the remote client.
Arguments
- Packetobject
message¶
This event is emitted when a message packet is received from the remote client.
Arguments
- Stringor- byte[]object sent by the remote client
Sending Data¶
Use the send method on EngineIoSocket to send packets to the remote client.
Queuing of packets in case of polling transport are handled internally by EngineIoSocket.
For example:
EngineIoSocket socket;  // connected socket
socket.send(new Packet<>(Packet.MESSAGE, "foo"));
Receiving Data¶
Listen on either the message or data event to receive data from the remote client.