aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Feature: Add trace_request_ctx for WS connections

Open mario-sangar opened this issue 3 years ago • 2 comments

What do these changes do?

Adding the possibility to pass trace_request_ctx when opening a Websocket connection. It's supported for all HTTP requests, but for some reason it was not an option for this method.

Are there changes in behavior for the user?

The argument is optional, so it shouldn't affect the current behavior of the method.

Related issue number

None

Checklist

  • [x] I think the code is well written
  • [ ] Unit tests for the changes exist
  • [x] Documentation reflects the changes
  • [x] If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • [x] Add a new news fragment into the CHANGES folder

mario-sangar avatar May 19 '22 18:05 mario-sangar

I also need this feature. Because if there's an exception to the websocket request, there's no way to retrieve the response body. The only way is to send a mutable object with trace_request_ctx and retrieve the data from it. Plus, since the trace configs that are passed with ClientSession work the same with ws_connect as normal http requests, ws_connect function not having trace_request_ctx param is clearly a missing implementation detail which needs a bug fix as soon as possible.

cakiralpx avatar Apr 04 '23 18:04 cakiralpx

@bdraco I think you work with websockets regularly? Mind reviewing?

webknjaz avatar Jan 29 '24 01:01 webknjaz

I'm traveling this week so I'm limited on time but I'll take a look at the end of the week or if I get some free time in between flights

bdraco avatar Jan 29 '24 01:01 bdraco