PingAsync() can not return true bool in Unity 2019.2.9f

Open
#574 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, unity
Domain
networking

Research direction

Start at the PingAsync() call shown in the issue and compare its behavior between Unity 2018 and Unity 2019.2.9f, including the callback result and coroutine wait; done means the version-specific cause and a verified resolution or documented limitation are established.

Written by the indexing model from the issue text.

Description

In Unity 2018, PingAsync() can return a true bool, but when I try in Unity 2019 2.9f, it can't.
Is there any change to use PingAsync() in Unity 2019?

Here is my code:

public IEnumerator WSS_PingAsync(){
    var ws = new WebSocketSharp.WebSocket(
        "wss://example.com", 
        "protocols")

    ws.Connect();

    bool successful = false;

    ws.PingAsync(result => successful = result);

    yield return new WaitUntil(() => successful || /*fail after 5s*/ );

    Debug.Log(successful)
}
Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from sta/websocket-sharp

All issues in sta/websocket-sharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.