Kabelwerk class
A Kabelwerk instance opens and maintains a websocket connection to the Kabelwerk backend; it is also used for retrieving and updating the connected user's info, opening inboxes and notifiers, and creating and opening rooms.
List of events
error
→ Fired when there is a problem establishing connection to the server. The attached event listeners are called with an ErrorEvent instance.ready
→ Fired when the connection to the server is first established and the Kabelwerk instance is ready to be used. The attached event listeners are called with a KabelwerkReadyEvent instance.connected
→ Fired when the connection to the server is established. This could be either because connect was invoked, or it could be due to automatically re-establishing the connection after a connection drop. Useful for displaying the connection's status to the user. The attached event listeners are called with a ConnectedEvent instance.disconnected
→ Fired when the connection to the server is dropped. Useful for displaying the connection's status to the user. The attached event listeners are called with a DisconnectedEvent instance.user_updated
→ Fired when the connected user's name has changed. The attached event listeners are called with an UserUpdatedEvent instance.
Constructors
Properties
- config → Config
-
The current configuration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → ConnectionState
-
The current connection state.
no setter
- user → User
-
The connected user.
no setter
Methods
-
connect(
) → Future< ConnectionState> - Establishes connection to the server.
-
createRoom(
int hubId) → Future< int> - Creates a chat room between the connected user and a hub.
-
disconnect(
) → void - Closes the connection to the server.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
[String? event, String? reference]) → void - Removes one or more previously attached event listeners.
-
on(
String event, Function function) → String - Attaches an event listener.
-
once(
String event, Function function) → String - Attaches a one-time event listener.
-
openInbox(
) → Inbox - Initialises and returns an Inbox instance.
-
openNotifier(
) → Notifier - Initialises and returns a Notifier instance.
-
openRoom(
[int roomId = 0]) → Room - Initialises and returns a Room instance for the chat room with the given ID.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateDevice(
{required String pushNotificationsToken, required bool pushNotificationsEnabled}) → Future< Device> - Sets and/or updates the push notifications settings for the currently connected device.
-
updateUser(
{required String name}) → Future< User> - Updates the connected user's name.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited