tauri-apps / tauri-apps/plugins-workspace

[websocket]losing message when socket openning

Open
#3,511 0 comments 0 reactions 0 assignees View on GitHub
plugin: websocket type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

### Describe the bug

When using ws, the message sent immediately inside the server connection callback is sometimes not received by the client, while the later message sent after a timeout is received correctly.

### Reproduction

_No response_

### Expected behavior

```javascript
const WS = require('ws');

const ws = new WS.Server({
port : 8080
});

ws.on("connection", (i) => {
i.send("hello world"); //this one is lost
setTimeout(() => {
i.send("hello world 2"); //this one is ok
}, 1000);
});
```
```json
"@tauri-apps/plugin-websocket": "^2.4.2"
```

### Full `tauri info` output

```text
[✔] Environment
- OS: Windows 10.0.26200 x86_64 (X64)
✔ WebView2: 150.0.4078.83
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.95.0 (59807616e 2026-04-14)
✔ cargo: 1.95.0 (f2d3ce0bd 2026-03-21)
✔ rustup: 1.29.0 (28d1352db 2026-03-05)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 22.18.0
- pnpm: 10.25.0
- npm: 10.9.3

[-] Packages
- tauri 🦀: 2.8.2
- tauri-build 🦀: 2.4.0
- wry 🦀: 0.53.1
- tao 🦀: 0.34.2
- @tauri-apps/api : 2.8.0 (outdated, latest: 2.11.1)
- @tauri-apps/cli : 2.8.1 (outdated, latest: 2.11.4)

[-] Plugins
- tauri-plugin-dialog 🦀: 2.4.0
- @tauri-apps/plugin-dialog : 2.4.0 (outdated, latest: 2.7.2)
- tauri-plugin-clipboard-manager 🦀: 2.3.0
- @tauri-apps/plugin-clipboard-manager : 2.3.0 (outdated, latest: 2.3.2)
- tauri-plugin-http 🦀: 2.5.2
- @tauri-apps/plugin-http : 2.5.2 (outdated, latest: 2.5.9)
- tauri-plugin-process 🦀: 2.3.0
- @tauri-apps/plugin-process : 2.3.0 (outdated, latest: 2.3.1)
- tauri-plugin-websocket 🦀: 2.4.1
- @tauri-apps/plugin-websocket : 2.4.2
- tauri-plugin-os 🦀: 2.3.1
- @tauri-apps/plugin-os : 2.3.1 (outdated, latest: 2.3.2)
- tauri-plugin-fs 🦀: 2.4.2
- @tauri-apps/plugin-fs : 2.4.2 (outdated, latest: 2.5.1)
- tauri-plugin-opener 🦀: 2.5.0
- @tauri-apps/plugin-opener : 2.5.2 (outdated, latest: 2.5.4)

[-] App
- build-type: bundle
- CSP: script-src 'self' 'wasm-unsafe-eval'; img-src 'self' asset: http: https: blob: data:
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Vue.js
- bundler: Vite
```

### Stack trace

```text

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the @tauri-apps/plugin-websocket 2.4.2 connection flow and reproduce the server callback case using the supplied JavaScript example. Compare delivery of the message sent immediately with the delayed message; done means the first message is reliably received by the client when the connection opens.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.