Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR Vs Server Sent Events HTML 5

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.

like image 992
Manas Kumar Avatar asked Sep 16 '14 07:09

Manas Kumar


1 Answers

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

  • https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events
  • https://caniuse.com/#search=server%20sent
like image 127
Steve B Avatar answered Oct 07 '22 11:10

Steve B