flutter_websocket_manager 0.0.3 copy "flutter_websocket_manager: ^0.0.3" to clipboard
flutter_websocket_manager: ^0.0.3 copied to clipboard

FlutterWebSocketManager is a Flutter package that simplifies the process of managing WebSocket connections. It provides an easy way to handle messages, errors, and connection states.

FlutterWebSocketManager #

FlutterWebSocketManager is a simple and flexible Flutter package for managing WebSocket connections. It helps you easily handle WebSocket connections, messages, errors, and connection states in your Flutter applications.

Features #

  • Connect to WebSocket servers with custom headers and query parameters.
  • Send and receive messages over WebSocket.
  • Handle connection states (connected, disconnected, etc.).
  • Handle errors and disconnections gracefully.
  • Set callback functions for message handling and errors.

Installation #

To install this package, add it to your pubspec.yaml file:

dependencies:
  flutter_websocket_manager: ^0.0.1

import 'package:flutter_websocket_manager/flutter_websocket_manager.dart';

void main() {
  final wsManager = FlutterWebSocketManager("wss://example.com/ws");

  wsManager.connect();

  wsManager.setMessageCallback((message) {
    print("Received message: $message");
  });

  wsManager.setErrorCallback((error) {
    print("Error: $error");
  });

  // To send a message
  wsManager.sendMessage({'type': 'ping'});

  // To disconnect
  wsManager.disconnect();
}
2
likes
0
points
186
downloads

Publisher

unverified uploader

Weekly Downloads

FlutterWebSocketManager is a Flutter package that simplifies the process of managing WebSocket connections. It provides an easy way to handle messages, errors, and connection states.

License

unknown (license)

Dependencies

flutter, mockito, web_socket_channel

More

Packages that depend on flutter_websocket_manager