ProjectBroadcast class
Project-wide broadcast for real-time messaging
Send and receive messages across your entire project with automatic reconnection.
Example:
final broadcast = ProjectBroadcast(
apiKey,
userId: 'user-123',
userName: 'John Doe'
);
broadcast.onMessage((data) {
print('Received: ${data['data']}');
});
broadcast.connect();
broadcast.send({'message': 'Hello everyone!'});
// Later
broadcast.disconnect();
Constructors
- ProjectBroadcast(String apiKey, {String? userId, String? userName, String baseURL = 'https://api.cocobase.buzz'})
Properties
Methods
-
connect(
) → void - Connect to the broadcast WebSocket
-
disconnect(
) → void - Disconnect from the broadcast
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onMessage(
Listener callback) → void - Listen for incoming messages
-
send(
Map< String, dynamic> data) → void - Send a message to all connected clients
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited