Skip to content

[BUG] The Serve-Send-Event request cannot receive a close event. #50804

Closed
@StringKe

Description

@StringKe

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.16.0
      npm: 9.5.1
      Yarn: 1.22.19
      pnpm: 8.6.0
    Relevant packages:
      next: 13.4.4
      eslint-config-next: 13.4.4
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3

Which area(s) of Next.js are affected? (leave empty if unsure)

Middleware / Edge (API routes, runtime)

Link to the code that reproduces this issue or a replay of the bug

https://stackblitz.com/edit/stackblitz-starters-n5uvup?file=pages%2Findex.js

To Reproduce

  1. open the recurrence connection (I did not find the page function of CodeSandbox, I used StackBlitz)
  2. Open the browser console
  3. Click the button and wait a while
  4. Click the button again.

Describe the Bug

Create an SSE (Server-Sent-Event) request using an API Endpoint that does not receive a disconnect event properly when the client disconnects.

Expected Behavior

API Request is able to accept disconnected events, as the inability to accept events causes the timer to run forever and add a new one each time it runs.

Which browser are you using? (if relevant)

Microsoft Edge 113.0.1774.57

How are you deploying your application? (if relevant)

none

note 2023-6-6

I tried to write an api with the same functionality using express and I can receive the close event.

https://github.com/StringKe/node-sse-example

link1: #48682

Metadata

Metadata

Assignees

No one assigned

    Labels

    RuntimeRelated to Node.js or Edge Runtime with Next.js.bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions