diff --git a/README.md b/README.md index 9129d94..7ca0a36 100644 --- a/README.md +++ b/README.md @@ -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: { @@ -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). | diff --git a/lib/src/options.dart b/lib/src/options.dart index 7934b87..1c334a4 100644 --- a/lib/src/options.dart +++ b/lib/src/options.dart @@ -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; @@ -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, @@ -104,7 +108,7 @@ class PusherOptions { ...parameters, if (hostUri?.query.isNotEmpty == true) ...hostUri!.queryParameters, }, - path: '/app/$key', + path: '${wsPath}/${key}', ); } diff --git a/pubspec.yaml b/pubspec.yaml index bdf6783..57145e2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: