kerimamansaryyev / dart_pusher_channels

MIT License
48 stars 13 forks source link

Connect to server via ip address #30

Closed mimoislam closed 1 year ago

mimoislam commented 1 year ago

Hello guys i have a problem to connect to server via ipü address my code

// Enable or disable logs PusherChannelsPackageLogger.enableLogs(); // Create an instance PusherChannelsOptions // The test options can be accessed from test.pusher.com (using only for test purposes) const testOptions = PusherChannelsOptions.fromCluster( scheme: 'ws', cluster: '', host: EVENT_URL, key: PUSHER_KEY, port: 6002, ); print(testOptions.uri.toString()); // Create an instance of PusherChannelsClient final client = PusherChannelsClient.websocket( options: testOptions, // Connection exceptions are handled here connectionErrorHandler: (exception, trace, refresh) async {

  print(exception);
  print(trace);
  // This method allows you to reconnect if any error is occurred.
  refresh();
},

);

I/flutter (29546): SocketException: Failed host lookup: 'ws-.xxx.xxx.xxx.xxx' (OS Error: No address associated with hostname, errno = 7) and the print is I/flutter (29546): ws://ws-.1xxx.xxx.xxx.xxx:xxx/app/xxxxxx?client=dart&version=1.0.0&protocol=7

can you help me

kerimamansaryyev commented 1 year ago

@mimoislam Have you checked the docs? For this case you may use either PusherChannelsOptions.fromHost or PusherChannelsOptions.custom. Check their usage at: https://pub.dev/packages/dart_pusher_channels#options

mimoislam commented 1 year ago

Yes it worked thank you for the advice

kerimamansaryyev commented 1 year ago

@mimoislam You may close the issue if it is solved.

kerimamansaryyev commented 1 year ago

@mimoislam Have a nice day!