aspnet / SignalR-samples

Samples for ASP.NET Core SignalR
753 stars 398 forks source link

Can i use bare EventSource() Sever Sent Event, to connect signalr hub ? #96

Closed mwkldeveloper closed 4 years ago

mwkldeveloper commented 4 years ago

Can i use bare js EventSource() Sever Sent Event, to connect signalr hub ?

If not , how to use sse with signalr ?

BrennanConroy commented 4 years ago

Can i use bare js EventSource() Sever Sent Event, to connect signalr hub ?

No, SignalR is a library with a protocol and the library will fallback to SSE internally if it can't use WebSockets.

If you want to use base EventSource for some reason, you'll need to read the SignalR protocol spec and implement the protocol yourself. https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/docs/specs/TransportProtocols.md and https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/docs/specs/HubProtocol.md