Skip to content

Long WebSocket messages are being truncated-wails dev #4211

@superDingda

Description

@superDingda

Description

While running the application with wails dev, the frontend (browser) and backend communicate over WebSocket. However, large messages fail to be delivered to the backend.

To Reproduce

Frontend (JavaScript):

  // If you're using Chrome, you need a string longer than 131000 characters to trigger packet fragmentation.
  // Reference: https://cse312.com/static_files/slides/3_5_WebSocket_Buffers.pdf
  const data = '...';
  function save() {
    console.log("frontend:", data.length);
    Save(data).then(result => resultText = result);
  }

Backend (Go):

func (a *App) Save(data string) {
	fmt.Println("backend:", len(data))
}

Expected behaviour

Expected: The backend Save function prints the length of the received data.
Actual: The backend Save function is not triggered.

Screenshots

No response

Attempted Fixes

No response

System Details

Wails Doctor          
                                

                                                                                
# Wails
Version         | v2.10.1
Package Manager | apt    


# System
WARNING: failed to read int from file: open /sys/devices/system/cpu/cpu0/online: no such file or directory
┌──────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                    |
| Version      | 20.04                                     |
| ID           | ubuntu                                    |
| Go Version   | go1.24.1                                  |
| Platform     | linux                                     |
| Architecture | amd64                                     |
| CPU          | 13th Gen Intel(R) Core(TM) i9-13900H      |
| GPU          | SVGA II Adapter (VMware) - Driver: vmwgfx |
| Memory       | 8GB                                       |
└──────────────────────────────────────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Available | 26.1.3-0ubuntu1~20.04.1 |
| gcc        | build-essential       | Installed | 12.8ubuntu1.1           |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.20-0ubuntu1.2      |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.38.6-0ubuntu0.20.04.1 |
| npm        | npm                   | Installed | 10.9.2                  |
| *nsis      | nsis                  | Available | 3.05-2                  |
| pkg-config | pkg-config            | Installed | 0.29.1-0ubuntu4         |
|                                                                          |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - docker: sudo apt install docker.io
  - nsis: sudo apt install nsis

 SUCCESS  Your system is ready for Wails development!

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions