Skip to content

Commit

Permalink
feat: minimal demonstration of the package
Browse files Browse the repository at this point in the history
  • Loading branch information
vsevex committed Aug 19, 2024
1 parent 655e0c1 commit 12f758e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ import 'package:whixp/whixp.dart';

void main() {
final whixp = Whixp(
'vsevex@example.com/desktop',
'passwd',
host: 'example.com',
logger: Log(enableError: true, enableWarning: true),
jabberID: 'vsevex@localhost',
password: 'vesevu13',
logger: Log(enableWarning: true, enableError: true, includeTimestamp: true),
internalDatabasePath: 'whixp',
reconnectionPolicy: RandomBackoffReconnectionPolicy(1, 3),
);

whixp.connect();
whixp.addEventHandler('sessionStart', (_) {
whixp.getRoster();
whixp.sendPresence();
/// Reconnect on disconnection.
whixp.addEventHandler<TransportState>('state', (state) {
if (state == TransportState.disconnected) whixp.connect();
});
whixp.connect();
}

0 comments on commit 12f758e

Please sign in to comment.