0

I am wondering about how to handle errors when sending data via SSE

Regular HTTP

If for example I want to fetch a User record by id via an http endpoint /users/:id and I encounter a non existing user I would respond with status code 404 and the client would handle it.

SSE

Now I'm wondering how this would look like for SSE. Let's say my endpoint is /users and takes a list of ids ?user_ids=[1, 2, 3]. The endpoint should find each record and send the results one by one. If the user with id 3 cannot be found, what is the protocol to convey this to the client?

nemequ
  • 15,543
  • 38
  • 58
matteok
  • 2,017
  • 3
  • 28
  • 50

1 Answers1

0

I found a post on the subject:
207 is a correct answer. The interesting fact is in the comments

The nice thing about it is that you can return as much or little of pertinent data as you want

I use :
200 with a partial content (mentionned here) as your data is partial yet pertinent

Do not use:
202 does mean the request is being processed.

IQbrod
  • 1,790
  • 1
  • 4
  • 23