Closed samehdoush closed 1 year ago
@samehdoush Hi, actually, I am planning to implement the feature in 2 upcoming months. But my biggest concern is that I need to test the encrypted channels. test.pusher.com supports only the presence channels. Could you please recommend any services to create the private encrypted channels for Pusher protocol?
@kerimamansaryyev If I create an ubuntu server + laravel project + (soketi or laravel websocket) and create a simple control panel to do experiments, does this help you?
@samehdoush That would be great! I am not server developer, can't configure hosting settings, though. Will this project be hosted somewhere?
@kerimamansaryyev The demo project has been added in: https://github.com/samehdoush/flutterWebsocket and auto deploy on server
I've put a simple example that currently only concerns encrypted channels (Send & Receive) on https://dart-pusher-channels.ps4tek.com/dashboard
https://github.com/samehdoush/flutterWebsocket/blob/main/README.md
I hope he can help you in adding the encrypted channels feature
Just create a new user and then go to the dashboard
Tell me if you want me to add types of public and private channel connections, etc...
@kerimamansaryyev The demo project has been added in: https://github.com/samehdoush/flutterWebsocket and auto deploy on server
I've put a simple example that currently only concerns encrypted channels (Send & Receive) on https://dart-pusher-channels.ps4tek.com/dashboard
https://github.com/samehdoush/flutterWebsocket/blob/main/README.md
I hope he can help you in adding the encrypted channels feature
Just create a new user and then go to the dashboard
Tell me if you want me to add types of public and private channel connections, etc...
It really means a lot to me and to my package, thank you for your support, I will start digging the case right from tomorrow!
@samehdoush could we communicate in some social media in case if some questions appear? Could you please send me your contacts to some of the social medias on my email - kerimamanwork@gmail.com ?
@kerimamansaryyev I sent the information to you by e-mail If you need anything, contact me
@samehdoush Got it, thank you!
@samehdoush The feature is ready and now it's in preview. Please visit the branch https://github.com/kerimamansaryyev/dart_pusher_channels/tree/feature/encrypted_channel
To check this out with an example:
pubspec.yaml
dart_pusher_channels:
git:
url: https://github.com/kerimamansaryyev/dart_pusher_channels
ref: feature/encrypted_channel
import 'dart:convert';
import 'package:dart_pusher_channels/dart_pusher_channels.dart'; import 'package:http/http.dart' as http;
void run() async { PusherChannelsPackageLogger.enableLogs(handler: print);
const hostOptions = PusherChannelsOptions.fromHost( scheme: 'wss', host: 'socketdemo.ps4tek.com', key: '30fad4c0b0b50a1a41ca', port: 443, );
final client = PusherChannelsClient.websocket( options: hostOptions, connectionErrorHandler: (exception, trace, refresh) {}, );
final loginResponse = await http.Client() .post(Uri.parse('https://dart-pusher-channels.ps4tek.com/api/login'), body: jsonEncode( { 'email': 'YOUR_USER_EMAIL', 'password': 'YOUR_USER_PASSWORD', 'device_name': 'YOUR_USER_DEVICE' }, ), headers: { 'Content-Type': 'application/json', });
final accessToken = jsonDecode(loginResponse.body)['access_token'] as String;
final authorizationDelegate = EndpointAuthorizableChannelTokenAuthorizationDelegate .forPrivateEncryptedChannel( authorizationEndpoint: Uri.parse( 'https://dart-pusher-channels.ps4tek.com/api/broadcasting/auth'), headers: { 'Authorization': 'Bearer $accessToken ', // token from api }, );
final privateChannel = client.privateEncryptedChannel( 'private-encrypted-user-test-2', authorizationDelegate: authorizationDelegate, );
privateChannel.bind('App\Events\UserTest').listen((event) { print('OBJECT ${event.rootObject}'); print('DATA ${event.tryGetDataAsMap()}'); });
client.onConnectionEstablished.listen((event) { privateChannel.subscribeIfNotUnsubscribed(); });
client.connect(); }
Implemented with PR #23
Thank you for this great package, it's the only one currently working with flutter and websocket laravel Is there a soon date for the launch of support for Encrypted channels?