Package io.socket.client
Class Socket
java.lang.Object
io.socket.emitter.Emitter
io.socket.client.Socket
public class Socket
extends io.socket.emitter.Emitter
The socket class for Socket.IO Client.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.socket.emitter.Emitter
io.socket.emitter.Emitter.Listener
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclose()
Disconnects the socket.connect()
Connects the socket.boolean
Disconnects the socket.io.socket.emitter.Emitter
Emits an event.io.socket.emitter.Emitter
Emits an event with an acknowledge.id()
A property on the socket instance that is equal to the underlying engine.io socket id.io()
boolean
isActive()
offAnyIncoming
(io.socket.emitter.Emitter.Listener fn) offAnyOutgoing
(io.socket.emitter.Emitter.Listener fn) onAnyIncoming
(io.socket.emitter.Emitter.Listener fn) onAnyOutgoing
(io.socket.emitter.Emitter.Listener fn) open()
Connects the socket.Send messages.Methods inherited from class io.socket.emitter.Emitter
hasListeners, listeners, off, off, off, on, once
-
Field Details
-
EVENT_CONNECT
Called on a connection.- See Also:
-
EVENT_DISCONNECT
Called on a disconnection.- See Also:
-
EVENT_CONNECT_ERROR
Called on a connection error.Parameters:
- (Exception) error data.
- See Also:
-
RESERVED_EVENTS
-
-
Constructor Details
-
Socket
-
-
Method Details
-
isActive
public boolean isActive() -
open
Connects the socket. -
connect
Connects the socket. -
send
Send messages.- Parameters:
args
- data to send.- Returns:
- a reference to this object.
-
emit
Emits an event. When you passAck
at the last argument, then the acknowledge is done.- Overrides:
emit
in classio.socket.emitter.Emitter
- Parameters:
event
- an event name.args
- data to send.- Returns:
- a reference to this object.
-
emit
Emits an event with an acknowledge.- Parameters:
event
- an event nameargs
- data to send.ack
- the acknowledgement to be called- Returns:
- a reference to this object.
-
close
Disconnects the socket.- Returns:
- a reference to this object.
-
disconnect
Disconnects the socket.- Returns:
- a reference to this object.
-
io
-
connected
public boolean connected() -
id
A property on the socket instance that is equal to the underlying engine.io socket id. The value is present once the socket has connected, is removed when the socket disconnects and is updated if the socket reconnects.- Returns:
- a socket id
-
onAnyIncoming
-
offAnyIncoming
-
offAnyIncoming
-
onAnyOutgoing
-
offAnyOutgoing
-
offAnyOutgoing
-