HttpContext and Response Headers in ASP.NET core SignalR calls?

Viewed 391

First of all, I understand that SignalR uses Websockets, LongPoll, SSEs as the underlying protocol. The call initially starts off as a HTTP handshake and eventually upgrades to one of the above three. (Please correct my understanding if this is not the case). Let us assume my service specifies the TransportType as WebSockets only.

Given this, and the fact that all subsequent calls are made through WebSocket protocol and not over HTTP, how is it that we are able to fetch HttpContext from SignalR Hub Context? It shouldn't be available after the first handshake since that is the only HTTP call right?

I am trying to pass response headers in SignalR calls back to clients - however I am on the verge of pulling my hair out since there seem to be absolutely no documentation on how to do that or that it is not supported.

Can you please help me understand the logic behind how and when HttpContext is populated in SignalR request context (HubContext)? Also, help figure out how to pass response headers if it is feasible?

0 Answers
Related