FlintWebSocket class

Represents a connected WebSocket client

Constructors

FlintWebSocket(WebSocket _socket, String id, {String namespace = '/'})

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
final
namespace String
final
rooms Set<String>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopedRooms Set<String>
no setter

Methods

broadcast(String message, {bool includeSelf = false}) → void
Broadcast to all connected clients
broadcastToRoom(String room, String message, {bool includeSelf = false}) → void
Broadcast to a specific room
emit(String event, dynamic data) → void
Emit an event with data
emitToAll(String event, dynamic data, {bool includeSelf = false}) → void
Emit to all connected clients
emitToNamespace(String path, String event, dynamic data, {bool includeSelf = false}) → void
Emit to every client in another websocket namespace/path.
emitToPathRoom(String path, String room, String event, dynamic data, {bool includeSelf = false}) → void
emitToRoom(String room, String event, dynamic data, {bool includeSelf = false}) → void
Emit to a specific room
emitToRoomIn(String path, String room, String event, dynamic data, {bool includeSelf = false}) → void
Emit to a room in another websocket namespace/path.
join(String room) → void
Join a room
leave(String room) → void
Leave a room
leaveAll() → void
Leave all rooms
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off(String event, void handler(dynamic data)) → void
Remove specific event listener
offAll(String event) → void
Remove all listeners for a specific event
offAllListeners() → void
Remove all event listeners
offJsonMessage(void handler(Map<String, dynamic> json)) → void
Remove JSON message listener
offMessage(void handler(dynamic message)) → void
Remove message listener
on(String event, void handler(dynamic data)) → void
Listen for specific events
onClose(void handler()) → void
Register a callback when socket is closed
onJsonMessage(void handler(Map<String, dynamic> json)) → void
Listen for JSON messages
onMessage(void handler(dynamic message)) → void
Listen for incoming messages (string or binary)
send(String message) → void
Send a text message
sendBytes(List<int> data) → void
Send binary data
sendJson(Map<String, dynamic> json) → void
Send JSON
toString() String
A string representation of this object.
inherited

Operators

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