Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket PING (important) #3336

Open
hoangdat opened this issue Dec 10, 2024 · 2 comments
Open

Websocket PING (important) #3336

hoangdat opened this issue Dec 10, 2024 · 2 comments
Assignees
Labels

Comments

@hoangdat
Copy link
Member

Desc

Websocket as a native ping. We shall rely on it.

This matter of fact actually do NOT satisfy me at all: it's too violent...

I asked ChatGPT to use websocket ping with your library.

  final channel = IOWebSocketChannel.connect(
    'wss://example.com/socket', // URL du serveur WebSocket
    pingInterval: Duration(seconds: 10), // Envoie un ping toutes les 10 secondes
  );

  // Écouter les messages du serveur
  channel.stream.listen(
    (message) {
      print('Message reçu : $message');
    },
    onDone: () {
      print('Connexion terminée');
    },
    onError: (error) {
      print('Erreur : $error');
    },
  );
@tddang-linagora
Copy link
Contributor

@tddang-linagora tddang-linagora self-assigned this Dec 10, 2024
@tddang-linagora
Copy link
Contributor

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket#instance_methods

Natively for web, there's no ping method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants