Game freezes when focusing back

Open
#82 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, unity

Research direction

Start with the README snippet and trace how Update() invokes websocket.DispatchMessageQueue(). Reproduce the alt-tab case with roughly 20 messages per second, then verify that messages do not accumulate and cause a freeze when focus returns.

Written by the indexing model from the issue text.

Description

I am using the snippet given in the README. On OnMessage, I do some complex and quite big data changes. I have ~20 messages per second.

The game works fine when it's focused, but when I alt-tab it, leave it there for some time, and go back, it gets frozen for a significant time. It seems that all the messages are queued while it's unfocused (as Update() doesn't seem to be happening) and then are processed when it gets focused again.

Anyway to fix this issue? It would be good if I could process the messages / call websocket.DispatchMessageQueue() outside the Update().

Dominant language
C#
Stars
1.7k
Forks
206
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 endel/NativeWebSocket

All issues in endel/NativeWebSocket

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.