dart-lang / dart-lang/http

[Ping Interval] WebSocketChannel.connect with pingInterval

Open
#1,563 4 comments 21 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package:web_socket_channel
Dominant language
Dart
Stars
1.1k
Forks
419
Avg merge
4d 14h
Merged PRs (30d)
8

Description

Hi, I have a question about how I can set pingInterval using WebSocketChannel.

I can set it by
`IOWebSocketChannel.connect(Uri.parse(url), pingInterval: Duration(seconds: 3)`

It works well for iOS and Android. But for web, I got Error: Unsupported operation: Platform._version.

Then I found instead of IOWebSocketChannel, WebSocketChannel (without IO) works on cross platforms.
When I try
`WebSocketChannel.connect(Uri.parse(url), pingInterval: Duration(seconds: 3));`

I found I cannot configure pingInterval.

Thanks in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the IOWebSocketChannel.connect and WebSocketChannel.connect entry points described in the issue, focusing on how pingInterval is handled on web versus iOS and Android. Confirm the expected cross-platform behavior and verify that configuring pingInterval no longer produces the reported web error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.