Skip to content

Commit

Permalink
provide information about caps in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vsevex committed Jul 28, 2023
1 parent 13cf703 commit 4585d00
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions lib/extensions/caps/README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Entity Capabilities

This extension provides support for handling capabilities in the XMPP protocol using Caps (short for **Capabilities**) feature. Allows a client to advertise its capabilities to other entities and discover the capabilities of other entities in the XMPP network.

## Features

- Advertise and discover capabilities of XMPP entities.
- Efficiently handle capabilities updates to avoid unnecessary queries.
- Automatic capabilities exchange during XMPP connection establishment.

## Limitations

Please note that you need to use `echo.disco.addFeature` and `echo.disco.addIdentity` methods to add capabilities features and identity to the client. This extension does not provide built-in methods for adding features and identities to the disco extension.

## Embedding

This extension comes built-in to the client. It means you do not need to attach this extension as you did on other extensions. You can not disable or enable this feature in any way.

## API

This code snippet demonstrates how to use this extension for the client.

```dart
import 'dart:async';
import 'dart:developer';
import 'package:echo/echo.dart';
Future<void> main() async {
final echo = Echo(service: 'ws://example.com:5443/ws');
await echo.connect(
jid: 'vsevex@example.com',
password: 'randompasswordwhichisgoingtobeyourpassword',
callback: (status) async {
if (status == EchoStatus.connected) {
log('Connection Established');
echo.disco.addFeature('someFeature');
echo.caps.sendPresence();
} else if (status == EchoStatus.disconnected) {
log('Connection Terminated');
} else if (status == EchoStatus.register) {
registrationCompleter.complete(true);
}
},
);
}
```

0 comments on commit 4585d00

Please sign in to comment.