user3037172
user3037172

Reputation: 587

HTTP and SignalR

I am recently learning about web sockets in .Net and have just found SignalR which seems like too good to be true in terms of the abstraction of what connection to use and it seems like there are a few signalr clients in different languages which is awesome.

In my current project different resources are being exposed through a RESTful API, and from my understanding of websockets the client needs to upgrade to a web socket connection through a HTTP request/response. Does signalR handle all this handshaking going on?

If there is an initial request/response from a GET request to retrieve a certain resource but they opt to upgrade to a socket connection, does the server give them any sort of response besides the response saying it acknowledges to open up a web socket connection or is the handshake all that occurs before the information is live updated for that particular resource?

Do you think signalR is scalable as opposed to implementing this through a protocol like STOMP where there are a large number of client libraries?

Upvotes: 0

Views: 3918

Answers (1)

Kenneth Li
Kenneth Li

Reputation: 1742

You are making things too complicated. A typical example of using signalr is:

  1. an html file using JavaScript to connect to a signalr Server when the page is loaded. we call this signalr client.

  2. a signalr server written in c#. it can be a winform or console or service.

  3. the signalr Server can call any dll, or webservices or webapi located in the same server, or even in different Server.

then, the client can call any function defined in the signalr server. the server can call any function defined in the client for a particular client or for groups of clients.

also, client x can call client y functions as well.

you can actually forget about Web sockets, signalr choose the most appropriate transport protocol for you. it will choose Web sockets if it is available in both the server and the client.

Upvotes: 2

Related Questions