Skip to content

Commit

Permalink
docs(websocket): update README
Browse files Browse the repository at this point in the history
  • Loading branch information
adar2378 committed Aug 17, 2023
1 parent f41470d commit a47975b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/djangoflow_websocket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The DjangoflowWebsocketBlocListener class, extending BlocListener, simplifies li

## Description

The project aims to provide a seamless integration of WebSocket functionality in a Flutter application using the `DjangoflowWebsocketCubit` class. It allows connecting to a WebSocket server, subscribing to messages, handling reconnections, and managing the WebSocket state.
The project aims to provide a seamless integration of WebSocket functionality in a Flutter application using the `DjangoflowWebsocketCubit` class. It allows re/connecting to a WebSocket server, subscribing to messages, handling reconnections, and managing the WebSocket state. Under the hood it extends `DjangoflowWebsocketCubitBase` and `websocket_channel`.

## Installation

Expand Down Expand Up @@ -86,25 +86,29 @@ import 'package:djangoflow_websocket/blocs/djangoflow_websocket_cubit/djangoflow
websocketCubit.disconnect();
```

## API Reference
**Note** `DjangoflowWebsocketCubitBase` can be extended to create more customizable Cubits to manage websocket connections.

### DjangoflowWebsocketCubit

#### **connectToUri(Uri uri)**

Connects to a WebSocket server at the specified uri. Emits connection state messages using the DjangoflowWebsocketState class.

#### **disconnect()**
#### **disconnect({int? closeCode, String? closeReason})**

Disconnects from the WebSocket server. Closes the channel sink and cancels the subscription.

### **sendMessage**

Send message to the WebSocket server.

#### **DjangoflowWebsocketState**

An immutable class that represents the state of the WebSocket connection. Includes properties like connectionStateMessage and message.

#### **DjangoflowWebsocketBlocListener**

A widget that listens to state changes from the DjangoflowWebsocketCubit and executes a callback when a new message is received. It extends BlocListener<DjangoflowWebsocketCubit, DjangoflowWebsocketState>.
A widget that listens to state changes from the DjangoflowWebsocketCubit and executes a callback when a new message is received.

## Contributing

Expand Down

0 comments on commit a47975b

Please sign in to comment.