keiser_metrics_connection 0.2.0 copy "keiser_metrics_connection: ^0.2.0" to clipboard
keiser_metrics_connection: ^0.2.0 copied to clipboard

Dart package for Keiser Metrics to handle both websockets and rest calls.

example/keiser_metrics_connection_example.dart

import 'package:keiser_metrics_connection/keiser_metrics_connection.dart';

void main() {
  final connection = MetricsConnection();

// Listen for state changes
connection.onConnectionStatusChange.listen(event => {/* websocket connected || websocket disconnected */});
connection.onServerStatusChange.listen(event => {/* server online || server offline */});
connection.onAuthenticationStatusChange.listen(event => {/* authenticated || unauthenticated || unknown */});
connection.onRefreshTokenChange.listen(event => {/* new refresh token */});

// You  must call this method before making a request to any authenticated routes.
// You can obtain a refresh token by signing in via our website.
await connection.initializeAuthenticatedSession(token: myRefreshToken);

// Use the `action` method to make requests to desired routes.
final response = await connection.action(path: '/user', method: 'user:show', method: 'GET');

// Dispose of the instance when you are done with it.
await connection.dispose();
}
0
likes
0
pub points
34%
popularity

Publisher

verified publisherdev.keiser.com

Dart package for Keiser Metrics to handle both websockets and rest calls.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, jwt_decoder, retry, web_socket_channel

More

Packages that depend on keiser_metrics_connection