Socket class

Socket constructor.

@api public

Available Extensions

Constructors

Socket(Manager io, String nsp, Map? _opts)

Properties

acks Map
getter/setter pair
active bool
Whether the Socket will try to reconnect when its Manager connects or reconnects
no setter
auth ↔ dynamic
getter/setter pair
connected bool
getter/setter pair
disconnected bool
Whether the socket is currently disconnected
no setter
flags Map
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String?
getter/setter pair
ids num
getter/setter pair
io ↔ Manager
getter/setter pair
nsp String
getter/setter pair
query String?
getter/setter pair
receiveBuffer List
getter/setter pair
recovered bool
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendBuffer List
getter/setter pair
subs List?
getter/setter pair
volatile Socket
Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not ready to send messages.
no setter

Methods

ack(dynamic id) Function
Produces an ack callback to emit with an event.
clearListeners() → void
This function unbinds all the handlers for all the events.
inherited
close() Socket
Disconnects the socket manually.
compress(dynamic compress) Socket
Sets the compress flag.
connect() Socket
destroy() → void
Called upon forced client/server side disconnections, this method ensures the manager stops tracking us and that reconnections don't get triggered for this.
disconnect() Socket
dispose() → void
Disposes the socket manually which will destroy, close, disconnect the socket connection and clear all the event listeners. Unlike close or disconnect which won't clear all the event listeners
emit(String event, [dynamic data]) → void
Override emit. If the event is in events, it's emitted normally.
emitBuffered() → void
Emit buffered events (received and emitted).
emitEvent(List args) → void
emitReserved(dynamic event, [dynamic data]) → void
alias used for reserved events (protected method)
inherited
emitWithAck(String event, dynamic data, {Function? ack, bool binary = false}) → void
Emits to this client.
emitWithAckAsync(String event, dynamic data, {Function? ack, bool binary = false}) Future
Emits an event and waits for an acknowledgement
hasListeners(String event) bool
Returns whether the event has registered.
inherited
listenersAny() List
Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
listenersAnyOutgoing() List
Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyOutgoingListeners(Map packet) → void
off(String event, [EventHandler? handler]) → void
This function attempts to unbind the handler from the event
inherited
offAny([AnyEventHandler? handler]) Socket
Removes the listener that will be fired when any event is emitted.
offAnyOutgoing([AnyEventHandler? handler]) Socket
Removes the listener that will be fired when any event is emitted.
on(String event, EventHandler handler) → dynamic Function()
This function binds the handler as a listener to the event
inherited
onack(Map packet) → void
Called upon a server acknowlegement.
onAny(AnyEventHandler handler) Socket
Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback.
onAnyOutgoing(AnyEventHandler handler) Socket
Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback.
once(String event, EventHandler handler) → void
This function binds the handler as a listener to the first occurrence of the event. When handler is called once, it is removed.
inherited
onclose(dynamic reason) → void
Called upon engine close.
onconnect(dynamic id, dynamic pid) → void
Called upon server connect.
ondisconnect() → void
Called upon server disconnect.
onerror(dynamic err) → void
Called upon engine or manager error
onevent(Map packet) → void
Called upon a server event.
onopen([dynamic _]) → void
Called upon engine open.
onpacket(dynamic packet) → void
Called with socket packet.
open() Socket
"Opens" the socket.
packet(Map packet) → void
Sends a packet.
prependAny(AnyEventHandler handler) Socket
Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback. The listener is added to the beginning of the listeners array.
prependAnyOutgoing(AnyEventHandler handler) Socket
Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback. The listener is added to the beginning of the listeners array.
send(List args) Socket
Sends a message event.
sendConnectPacket(Map? data) → void
Sends a CONNECT packet to initiate the Socket.IO session.
subEvents() → void
Subscribe to open, close and packet events
timeout(int timeout) Socket
Sets a modifier for a subsequent event emission that the callback will be called with an error when the given number of milliseconds have elapsed without an acknowledgement from the server:
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited