Skip to content

Commit fb29860

Browse files
authored
v0.15.0 development (#93)
1 parent 1649aa3 commit fb29860

File tree

24 files changed

+1476
-950
lines changed

24 files changed

+1476
-950
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ jobs:
66
build:
77
# Prevent duplicate builds on internal PRs.
88
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
9-
environment: test_ci
109
runs-on: ubuntu-latest
1110
strategy:
1211
matrix:
13-
sdk: [2.19, stable, beta]
12+
sdk: [3.4, stable, beta] # note, not testing on 3.3 due to build_runner CI dependency problem.
1413
steps:
1514
- uses: actions/checkout@v4
1615

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Publish to pub.dev
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
jobs:
9+
publish:
10+
permissions:
11+
id-token: write # Required for authentication using OIDC
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Websocket client for [Centrifugo](https://github.com/centrifugal/centrifugo) server and [Centrifuge](https://github.com/centrifugal/centrifuge) library.
22

3-
There is no v1 release of this library yet – API still evolves. At the moment patch version updates only contain backwards compatible changes, minor version updates can have backwards incompatible API changes.
3+
Since there is no v1 release yet, patch version updates only contain backwards compatible changes, minor version updates can have backwards incompatible API changes.
44

55
Check out [client SDK API specification](https://centrifugal.dev/docs/transports/client_api) to learn how this SDK behaves. It's recommended to read that before starting to work with this SDK as the spec covers common SDK behavior - describes client and subscription state transitions, main options and methods. Also check out examples folder.
66

77
The features implemented by this SDK can be found in [SDK feature matrix](https://centrifugal.dev/docs/transports/client_sdk#sdk-feature-matrix).
88

9-
Note that custom WebSocket connection Upgrade headers can only be set on platforms that support `dart:io`. So notably custom headers set in the configuration of `Client` are ignored on the web platform.
9+
Note that custom WebSocket connection Upgrade headers are sent natively on platforms that support `dart:io` and in web context headers are sent using Centrifugo v6 [Headers Emulation](https://centrifugal.dev/blog/2025/01/16/centrifugo-v6-released#headers-emulation) feature.
1010

1111
> **The latest `centrifuge-dart` is compatible with [Centrifugo](https://github.com/centrifugal/centrifugo) server v6, v5 and v4 and [Centrifuge](https://github.com/centrifugal/centrifuge) >= 0.25.0. For Centrifugo v2, Centrifugo v3 and Centrifuge < 0.25.0 you should use `centrifuge-dart` v0.8.0.**
1212
@@ -20,6 +20,10 @@ Note that custom WebSocket connection Upgrade headers can only be set on platfor
2020

2121
When a mobile application goes to the background there are OS-specific limitations for established persistent connections - which can be silently closed shortly. Thus in most cases you need to disconnect from a server when app moves to the background and connect again when app goes to the foreground.
2222

23+
## Alternative SDK
24+
25+
See also [PlugFox/spinify](https://github.com/PlugFox/spinify) for an alternative Dart (Flutter) real-time client SDK implementation.
26+
2327
## Instructions for maintainers/contributors
2428

2529
### How to update protobuf definitions
@@ -31,9 +35,8 @@ When a mobile application goes to the background there are OS-specific limitatio
3135

3236
### How to release
3337

34-
1) Update changelog
35-
2) Bump version in `pubspec.yaml`, push, create new tag
36-
3) `dart pub publish`
38+
1) Bump version in `pubspec.yaml`, push, create new tag
39+
2) [ONLY IF THERE ARE ISSUES WITH CI PUBLISH] `dart pub publish`
3740

3841
## Author
3942

analysis_options.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ linter:
3838
- empty_statements
3939
- hash_and_equals
4040
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
41-
- iterable_contains_unrelated_type
42-
- list_remove_unrelated_type
4341
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
4442
- no_adjacent_strings_in_list
4543
- no_duplicate_case_values
@@ -51,7 +49,6 @@ linter:
5149
# === style rules ===
5250
- always_declare_return_types
5351
# - always_put_control_body_on_new_line
54-
- always_require_non_null_named_parameters
5552
# - always_specify_types
5653
- annotate_overrides
5754
# - avoid_annotating_with_dynamic # not yet tested

example/chat_app/lib/client/client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class ChatClient {
3131
url,
3232
ClientConfig(
3333
token: conf.userJwtToken,
34-
headers: <String, dynamic>{
35-
'user-id': chatUserId,
34+
headers: <String, String>{
35+
'user-id': chatUserId.toString(),
3636
'user-name': chatUserName,
3737
},
3838
),

example/chat_app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
88
version: 0.1.0
99

1010
environment:
11-
sdk: ">=2.19.0 <4.0.0"
11+
sdk: ">=3.3.0 <4.0.0"
1212

1313
dependencies:
1414
centrifuge:

example/console/example.dart

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ void main() async {
88
final channel = 'chat:index';
99
// generate user JWT token for user "dart":
1010
// ./centrifugo gentoken --user dart
11+
// For this example we generated token using HMAC secret key "secret". Don't forget
12+
// that it's just an example, and tokens must NEVER be generated on client side and
13+
// HMAC secret must NEVER be revealed to client side.
1114
final userJwtToken =
12-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkYXJ0IiwiZXhwIjoyMjc5NDQzNjgwLCJpYXQiOjE2NzQ2NDM2ODB9.XgsPZzAD4kMj7HdybJfpMGuDaRmuLvhUUxCGHs3mtXA';
15+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkYXJ0IiwiaWF0IjoxNzM3ODAwOTcxfQ.m30QzH9nxqMSJw3g5gL5Tjqnu-veQSn4RcH47ZozqQI';
1316
// generate subscription JWT token for user "dart" and channel "chat:index":
1417
// ./centrifugo gensubtoken --user dart --channel chat:index
18+
// For this example we generated subscription token using HMAC secret key "secret". Don't forget
19+
// that it's just an example, and tokens must NEVER be generated on client side and
20+
// HMAC secret must NEVER be revealed to client side.
1521
final subscriptionJwtToken =
16-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkYXJ0IiwiZXhwIjoyMjc5NDQ0MDE4LCJpYXQiOjE2NzQ2NDQwMTgsImNoYW5uZWwiOiJjaGF0OmluZGV4In0.FjpnF6ofq3XCr1iqnwTZcpxCx6btuzCnn29DAIJbsBo';
22+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkYXJ0IiwiaWF0IjoxNzM3ODAxMDIwLCJjaGFubmVsIjoiY2hhdDppbmRleCJ9.fe3WguZKkGiTyacpUW-WJW-1yzpZTHAFO6FWo7gbbTs';
1723

1824
final onEvent = (dynamic event) {
1925
print('client> $event');
@@ -24,8 +30,10 @@ void main() async {
2430
url,
2531
centrifuge.ClientConfig(
2632
token: userJwtToken,
27-
// Headers are only supported on platforms that support dart:io
28-
headers: <String, dynamic>{'X-Example-Header': 'example'},
33+
// If you want to use Headers in web environment – make sure your headers use
34+
// string values, centrifuge-dart will then automatically attach them to connect
35+
// frame (using Headers Emulation feature).
36+
headers: <String, String>{'X-Example-Header': 'example'},
2937
));
3038

3139
// State changes.

example/flutter_app/analysis_options.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ linter:
3939
- empty_statements
4040
- hash_and_equals
4141
# - invariant_booleans # https://github.com/flutter/flutter/issues/5790
42-
- iterable_contains_unrelated_type
43-
- list_remove_unrelated_type
4442
# - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791
4543
- no_adjacent_strings_in_list
4644
- no_duplicate_case_values
@@ -52,7 +50,6 @@ linter:
5250
# === style rules ===
5351
- always_declare_return_types
5452
# - always_put_control_body_on_new_line
55-
- always_require_non_null_named_parameters
5653
# - always_specify_types
5754
- annotate_overrides
5855
# - avoid_annotating_with_dynamic # not yet tested

example/flutter_app/ios/Flutter/flutter_export_environment.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# This is a generated file; do not edit or check into version control.
3-
export "FLUTTER_ROOT=/usr/local/Caskroom/flutter/3.10.6/flutter"
3+
export "FLUTTER_ROOT=/usr/local/Caskroom/flutter/3.24.4/flutter"
44
export "FLUTTER_APPLICATION_PATH=/Users/fz/projects/centrifugal/centrifuge-dart/example/flutter_app"
55
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
66
export "FLUTTER_TARGET=lib/main.dart"

example/flutter_app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: centrifuge_app
22
description: A new Flutter project.
33

44
environment:
5-
sdk: '>=2.19.0 <4.0.0'
5+
sdk: '>=3.3.0 <4.0.0'
66

77
dependencies:
88
flutter:

0 commit comments

Comments
 (0)