7

For real time push notification I know SignaR and Server Sent Events in HTML5(EventSource)?

Whatever SignalR is doing, I can achieve with server sent events. My doubt is in which scenario I should use SignaR and SSE.

Thank you.

Manas Kumar
  • 2,411
  • 3
  • 16
  • 23
  • [WebSockets vs. Server-Sent events](https://stackoverflow.com/questions/5195452/websockets-vs-server-sent-events-eventsource) interesting comparison – caramba Feb 04 '20 at 10:10

1 Answers1

8

Server sent event is supported by only a few set of browsers.

That said, one of the goal of SignalR is to create an abstraction of the transport protocol. It allows the developer to focus on the logic of the application. Not how the data is transferred. Under the hood, SignalR will choose the appropriate transport, depending both on the server and the client capabilities.

With modern browsers, WebSockets will be used, whereas on old long polling will be used.

More info in the Transports section in the official documentation.


Update May 2020

Server Sent Events are supported by all major Browsers, just not in IE

brst
  • 5
  • 4
Steve B
  • 36,818
  • 21
  • 101
  • 174
  • "SignalR is to create an abstraction of the transport protocol" what does it mean actually? – Manas Kumar Sep 16 '14 at 09:02
  • that means you only care of the "what" and not the "how". Signal will take care of the underlying transport, whatever it is. – Steve B Sep 16 '14 at 09:18
  • Then I should use SignalR rather than SSE due to browser incompatibilty, right? – Manas Kumar Sep 19 '14 at 10:42
  • if you plan to be compatible with the vast majority of browser then yes. But this is not the only advantage of SignalR. Adding an abstraction over the transport enables you to focus on the application and not on the transport. – Steve B Sep 19 '14 at 11:56
  • 1
    Shouldn't the link written in this answer "by only a few set of browsers" => https://caniuse.com/#search=sent point to https://caniuse.com/#search=sse ? Cause we are talking here about `signalR` vs `SSE` – caramba Feb 03 '20 at 14:45