postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.85k stars 841 forks source link

Only one of the server-sent events is shown when they are sent rapidly. #12448

Open menties opened 1 year ago

menties commented 1 year ago

Is there an existing issue for this?

Describe the Issue

Hello,

I've encountered some issues related to Server-Sent Events (SSE). When I send a request multiple times in the same tab, only one of the server-sent events is displayed:

Screenshot 2023-11-03 at 13 51 12

Additionally, the 'Clear Messages' button seems to clear only the most recent 'Connection closed' message:

Screenshot 2023-11-03 at 13 56 42 Screenshot 2023-11-03 at 13 56 51

This issue seems to be resolved when I introduce a delay of at least 500 ms between each event. I noticed this issue after updating my Postman version to the latest one, which is 10.19.14. In version 10.14.9, it was working perfectly.

Steps To Reproduce

  1. Open a new request tab
  2. Send a request to SSE streaming endpoint
  3. Wait until the connection is closed
  4. Send a request again

Screenshots or Videos

No response

Operating System

Windows/MacOS

Postman Version

10.19.14

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

Vrajs16 commented 10 months ago

I am having the same issue

Vrajs16 commented 9 months ago

I fixed the problem by removing extra \n that I had inside my resp I want to send from the api. The response from the api should follow a similiar format such as data: {resp} \n\n without having more \n in the resp.

pocketcolin commented 8 months ago

I'm also running into this issue and there seem to be some other issues connected. What is Postman's required format for SSE messages? Running the same request with cURL through the terminal shows all messages so I'm unclear on what Postman specifically needs to show messages.

AddisonG commented 2 months ago

I got this when I was accidentally gzipping responses from my server - the data is only decoded on connection close, or after a large enough chunk is sent.


EDIT - I keep running into this stupid issue, and forgetting the solution, and I swear to god I'm the only man on the planet who has figured it out, so I have to crawl around in the dirt looking for this exact comment, so that I can re-educate myself.

Postman does a great job of absolutely shooting your entire leg off when dealing with SSE, because it has the Accept-Encoding header set to gzip, deflate, br by default, so when I use a simple curl to test my endpoint, it works great - but Postman silently breaks.

image

I would really appreciate if postman warned you when you set gzip and SSE, because it's completely broken.