public final class SocketIoSocket
extends io.socket.engineio.server.Emitter
Modifier and Type | Class and Description |
---|---|
static interface |
SocketIoSocket.AllEventListener
Callback for all user events received on socket.
|
static interface |
SocketIoSocket.ReceivedByLocalAcknowledgementCallback
Callback for local received acknowledgement.
|
static interface |
SocketIoSocket.ReceivedByRemoteAcknowledgementCallback
Callback for remote received acknowledgement.
|
Modifier and Type | Method and Description |
---|---|
void |
broadcast(String[] rooms,
String event,
Object[] args)
Broadcast a message to all clients in this namespace that
have joined specified rooms except this client.
|
void |
broadcast(String room,
String event,
Object... args)
Broadcast a message to all clients in this namespace that
have joined specified room except this client.
|
void |
disconnect(boolean close)
Disconnect this socket.
|
boolean |
equals(Object obj) |
Object |
getConnectData()
Gets the data packet sent while establishing the socket connection.
|
String |
getId()
Gets the id of this socket.
|
Map<String,List<String>> |
getInitialHeaders()
Gets the headers of the initial HTTP connection.
|
Map<String,String> |
getInitialQuery()
Gets the query parameters of the initial HTTP connection.
|
SocketIoNamespace |
getNamespace()
Gets the namespace of this socket.
|
int |
hashCode() |
void |
joinRoom(String... rooms)
Adds the socket to the specified rooms.
|
void |
leaveAllRooms()
Removes the socket from all rooms.
|
void |
leaveRoom(String... rooms)
Removes the socket from the specified rooms.
|
void |
registerAllEventListener(SocketIoSocket.AllEventListener listener)
Register listener for all user events.
|
void |
send(String event,
Object... args)
Send data to remote client.
|
void |
send(String event,
Object[] args,
SocketIoSocket.ReceivedByRemoteAcknowledgementCallback acknowledgementCallback)
Send data to remote client.
|
void |
unregisterAllEventListener(SocketIoSocket.AllEventListener listener)
Unregister listener registered with registerAllEventListener.
|
public String getId()
public SocketIoNamespace getNamespace()
public Object getConnectData()
public Map<String,String> getInitialQuery()
public Map<String,List<String>> getInitialHeaders()
public void disconnect(boolean close)
close
- Whether to close the remote connection or not.public void broadcast(String room, String event, Object... args) throws IllegalArgumentException
room
- Room to send message to.event
- Name of event to raise on remote client.args
- Arguments to send. Supported types are: JSONObject, JSONArray, null.IllegalArgumentException
- If event is null or argument is not of supported type.public void broadcast(String[] rooms, String event, Object[] args) throws IllegalArgumentException
rooms
- Rooms to send message to.event
- Name of event to raise on remote client.args
- Array of arguments to send. Supported types are: JSONObject, JSONArray, null.IllegalArgumentException
- If argument is not of supported type.public void send(String event, Object... args) throws IllegalArgumentException
event
- Name of event to raise on remote client.args
- Array of arguments to send. Supported types are: JSONObject, JSONArray, null.IllegalArgumentException
- If event is null or argument is not of supported type.public void send(String event, Object[] args, SocketIoSocket.ReceivedByRemoteAcknowledgementCallback acknowledgementCallback) throws IllegalArgumentException
event
- Name of event to raise on remote client.args
- Array of arguments to send. Supported types are: JSONObject, JSONArray, null.acknowledgementCallback
- Acknowledgement callback to call on remote ack or null.IllegalArgumentException
- If event is null or argument is not of supported type.public void joinRoom(String... rooms)
rooms
- List of rooms to join.public void leaveRoom(String... rooms)
rooms
- List of rooms to leave.public void leaveAllRooms()
public void registerAllEventListener(SocketIoSocket.AllEventListener listener)
listener
- Listener to register.public void unregisterAllEventListener(SocketIoSocket.AllEventListener listener)
listener
- Listener to unregister.Copyright © 2022. All rights reserved.