Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ import 'package:pusher_client_socket/channels/presence_channel.dart';
key: 'REVERB_APP_KEY',
host: 'localhost', // REVERB_HOST
wsPort: 6001, // REVERB_PORT
encrypted: false, // (Note: enable it if you'r using wss connection)
wsPath: '/app',
encrypted: false, // (Note: enable it if you're using wss connection)
authOptions: PusherAuthOptions(
endpoint: 'http://localhost/broadcasting/auth',
headers: {
Expand Down Expand Up @@ -157,12 +158,13 @@ channel.unsubscribe();
## Pusher Client Options

| Option | Type | Description |
| ------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|---------------------------|-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| `key` | `String` | The Pusher app key used to authenticate the connection. This is a required parameter. |
| `cluster` | `String?` | The cluster of the Pusher server. If provided, it is used to construct the default WebSocket host. |
| `host` | `String?` | The custom host for the connection. If not provided, it defaults to the Pusher WebSocket host based on the cluster. |
| `wsPort` | `int` | The ws port of the connection (default: 80). |
| `wssPort` | `int` | The wss port of the connection (default: 443). |
| `wsPath` | `String` | The path portion of the connection url (default: /app). |
| `encrypted` | `bool` | A flag indicating whether to enable encrypted connection. Default is `false`. |
| `activityTimeout` | `int` | The activity timeout in milliseconds. This is the duration after which a ping is sent if no activity is detected. Default is 120000 (2 minutes). |
| `pongTimeout` | `int` | The timeout in milliseconds for waiting for a pong response after a ping is sent. Default is 30000 (30 seconds). |
Expand Down
6 changes: 5 additions & 1 deletion lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class PusherOptions {
/// The wss port of the connection (default: 443).
final int wssPort;

/// The path portion of the connection (default: /app).
final String wsPath;

/// Enable encryption for the connection.
final bool encrypted;

Expand Down Expand Up @@ -64,6 +67,7 @@ class PusherOptions {
this.host,
this.wsPort = 80,
this.wssPort = 443,
this.wsPath = '/app',
this.encrypted = true,
this.activityTimeout = 120000,
this.pongTimeout = 30000,
Expand Down Expand Up @@ -104,7 +108,7 @@ class PusherOptions {
...parameters,
if (hostUri?.query.isNotEmpty == true) ...hostUri!.queryParameters,
},
path: '/app/$key',
path: '${wsPath}/${key}',

Copilot AI Jun 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider normalizing wsPath (e.g., trimming a trailing slash) before concatenation to prevent duplicate or missing slashes in the final URL.

Suggested change
path: '${wsPath}/${key}',
path: '${wsPath.replaceAll(RegExp(r'/+$'), '')}/${key}',

Copilot uses AI. Check for mistakes.
);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pusher_client_socket
description: "The pusher client using websocket client [available for all platforms]"
version: 0.0.5
version: 0.0.6
homepage: https://github.com/AbdoPrDZ/pusher_client_socket

environment:
Expand Down