-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Welcome to the chatapp wiki!
In this application I want to show how to chatting in asp.net using SignalR. I show how to do a public and private chat. The chatting data will store in the database.
ASP.NET SignalR is a library that simplifies the process of adding real-time web functionality to applications. SignalR connected clients instantly as it becomes available and the server wait for a client to request new data.
SignalR is an abstraction over some of the transports that are required to do real-time work between client and server. A SignalR connection starts as HTTP, and is then promoted to a WebSocket connection if it is available. WebSocket is the ideal transport for SignalR, since it makes the most efficient use of server memory, has the lowest latency, and has the most underlying features (such as full duplex communication between client and server), but it also has the most stringent requirements: WebSocket requires the server to be using Windows Server 2012 or Windows 8, and .NET Framework 4.5. If these requirements are not met, SignalR will attempt to use other transports to make its connections. SignalR is a technology that used a real-time work between client and server. It used WebSocket for a ideal transport, it makes the most efficient use of server memory. WebSocket has the full duplex communication between client and server. But WebSocket requires the server to be using Windows Server 2012 or Windows 8, and .NET Framework 4.5. SignalR connection starts as HTTP, and is then promoted to a WebSocket connection if it is available. If these requirements are not met, SignalR will attempt to use other transports to make its connections.
Two types of transport:
A) HTML 5 transports
i) WebSocket: If the both the server and browser indicate they can support Websocket. It supports latest versions of Microsoft Internet Explorer, Google Chrome, and Mozilla Firefox, and only has a partial implementation in other browsers such as Opera and Safari.
ii) Server Sent Events: Its known as EventSource. If the browser supports Server Sent Events, which is basically all browsers except Internet Explorer.
B) Comet transports
i) Forever Frame: It supports Internet Explorer only. Forever Frame creates a hidden IFrame which makes a request to an endpoint on the server that does not complete.
ii) Ajax long polling: 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.
- If the browser is Internet Explorer 8 or earlier, Long Polling is used.
- If the SignalR endpoint is not in the same domain as the hosting page, then WebSocket will be used if the following criteria are met:
- The client supports CORS (Cross-Origin Resource Sharing).
- The client supports WebSocket.
- The server supports WebSocket.
- If any of these criteria are not met, Long Polling will be used.
- If JSONP is not configured and the connection is not cross-domain, WebSocket will be used if both the client and server support it.
- If either the client or server do not support WebSocket, Server Sent Events is used if it is available.
- If Server Sent Events is not available, Forever Frame is attempted.
- If Forever Frame fails, Long Polling is used.