Socket class

Handles the underlying socket connection with the socket server

Inheritance

Constructors

Socket.create()
Creates the socket and returns the instance of the socket if already initialized you need to call connect method to connect to the server
factory
Socket.getInstance()
Returns the instance of the socket connection, throws an error if the connection is not initialized
factory

Properties

closed bool
Returns true if the socket connection is closed
no setter
connected bool
Returns true if the socket connection is connected
no setter
connecting bool
Returns true if the socket connection is connecting
no setter
connectionState ConnectionState
Returns the current connection state of the socket connection
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
region String?
Getter for the region of the current socket connection
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
token String?
Token of the current socket connection, specific to the Local Peer who joined the meeting
getter/setter pair
ws → IOWebSocketChannel?
Returns the underlying WebSocket connection
no setter

Methods

callback(Function func, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → dynamic
inherited
callbackAsFuture(Function func, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) Future
inherited
clearListeners() → void
This function unbinds all the handlers for all the events
inherited
close(ESocketCloseCode code, {bool reconnect = false}) → void
Closes the underlying socket connection, and clears all the event listeners and subscriptions to events as well as any other information related to the connection. @param code { ESocketCloseCode }
connect(String token) Future<Socket>
Connect to the socket server using the token @param data - {String token }
emit(String event, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) → void
This function triggers all the handlers currently listening to event and passes them data.
inherited
emitAsFuture(String event, [dynamic arg0, dynamic arg1, dynamic arg2, dynamic arg3, dynamic arg4, dynamic arg5]) Future
This function triggers all the handlers currently listening to event and passes them data.
inherited
listeners(dynamic event) List
Return function list named event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off(String event) → void
This function attempts to unbind all the handler from the event
inherited
on(String event, Function handler) → void
This function binds the handler as a listener to the event
inherited
once(String event, Function 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
publish(Request_Request event, Map<String, dynamic>? incomingData) → void
remove(String event, Function handler) → void
This function attempts to unbind the handler from the event
inherited
removeAllListeners([dynamic eventName]) → void
inherited
safeEmit(String event, [Map<String, dynamic>? args]) → void
inherited
safeEmitAsFuture(String event, [Map<String, dynamic>? args]) Future
inherited
setRegion(String? region) → void
Set a new region for the socket connection
setToken(String token) → void
Update the token for this socket @throws Exception if the token is already set
subscribe<K, P>(K event, P fn) → void
toString() String
A string representation of this object.
inherited

Operators

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