What is the difference between web sockets, long polling, server-sent events and forever frame?
Asked Answered
S

1

18

I'm currently exploring SignalR, this technology supports transports (web wockets, long polling ,server-sent events and forever frame).

I have understood the terminology web sockets and long polling. But what is Server-Sent Events and Forever Frame?

How all four differ from each other?

Schaerbeek answered 7/10, 2013 at 13:55 Comment(1)
Information on all the transport types can be found in the Introduction to SignalR document at asp.net/signalr/overview/getting-started/…Defect
C
25

Transports and fallbacks of SignalR:

WebSocket Full-duplex

Websocket is a full-duplex communication channels over a single TCP connection. When both server and browser support, it is the only transport that establishes a true persistent, two-way connection between client and server.

Server Sent Events Simplex

also known as EventSource is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is standardized as part of HTML5 by the W3C.

Forever Frame One request -> One infinite response

Forever Frame creates a hidden IFrame which makes a request to an endpoint on the server that does not complete. The server then continually sends script to the client which is immediately executed, providing a one-way realtime connection from server to client. The connection from client to server uses a separate connection from the server to client connection, and like a standard HTTP request, a new connection is created for each piece of data that needs to be sent.

Ajax long polling (One Request -> One Response [but delayed]) repeated

Long polling does not create a persistent connection, but instead polls the server with a request that stays open until the server responds, at which point the connection closes, and a new connection is requested immediately. This may introduce some latency while the connection resets.

More info:

https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/introduction-to-signalr https://en.wikipedia.org/wiki/Server-sent_events

Cerracchio answered 4/8, 2017 at 15:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.