How is SSE implemented in SignalR? - signalr

I'm curious to find out how Server Sent Events, SSE, is implemented in SignalR - on the server side. I've looked at the code but can't find the implementation. Can anyone point me in the right direction?
Thanks!

Related

Sending huge message from HTTP server to an angular client

From a win32 HTTP server I have to send a big (~32MB) message to an angular based client running in chrome.
Must I use Websocket for this purpose ?
Or should I use Server-sent-events (SSE) ?
What are my alternatives ?
Thank you,
Zvika
Neither Websocket nor SSE are for sending large messages specifically and it makes sense to use specifically for solving this problem.
HTTP works perfectly fine with large responses, even if it's gigabytes. Try it. If you run into problems report back here with detailed explanations of what failed.

why doesn't a client using UDP connect to an HTTP server correctly?

I am not quite sure I understand why this doesn't work. Is this possible? What are the pitfalls of using this if we decide it is possible?
There are actually efforts pursuing such an approach. It ultimately led to the development of coap. But plain HTTP cannot work on UDP, as all packets being sent out are essentially "fire and forget," lacking any guarantee for them to arrive their designated target. Also, order of packets can be entirely different on the receiving side. I believe there were some efforts to get HTTP running via sctp, though.
If you're seriously going down this route, you may want to look at QUIC: https://www.chromium.org/quic

Detect FlexClient disconnect on Longpolling Channel

I'm developing a chat system and i need to detect the FlexClient disconnect in Java, using the longpolling channel.
I can't use the Streaming channel, because of some bugs that this kind of channel still has. Do you have any suggestion on how could i accomplish this? I'm using BlazeDS.
Regards.
There is no way to detect a client disconnect in real time unless using an RMTP channel which is using behind a socket. When using different channels you can do some workarounds like having some javascript in your web detecting the page unload event, or you can have your client using some kind of heart bit mechanism.

Flex client disconecting

I am using BlazeDS. Does anybody know how to disconnect client from server? Client must be informed about this event.
Thanks for help.
As far as I knew BlazeDS does not support open connections between the Flash Player and the server. You'll have to use LiveCycle if you want to do that.
When you make a server call using the HTTPService, WebService, or RemoteObject tags, there are events that fire when you receive feedback from the server, such as result or fault. When those events fire, you can safely assume that that service call is no longer connected ot the server.

What's the best way for the server to send messages to a web client?

Links to articles would also be appreciated--I don't know the terminology to search for.
I'm looking to learn how a web application can allow for server-to-client communications. I know the web was not designed for this and that it has been something of a hurdle, and am just wondering what the state of this is, and what the best practices are.
An alternative is constant or occasional polling via ajax, but is it possible for web servers to maintain stateful connections to a web client?
Edit: Another way to ask this question is how does StackOverflow tell a page that new posts are available for it to display that little bar at the top?
StackOverflow polls the server to check if there is more data.
What you're looking for is Comet.
To get true two way communications from a browser you need to use a plugin technology like Silverlight, Flash, et al. Those plugins can create TCP connections that can establish a two way persistent connection with a server socket. Note that you can't really establish the TCP connection with the HTTP server so you'd have to create an additional server agent to do the communicating back to the browser.
Basically it's a completely differnet deployment model to what AJAX sites like Stackoverflow, Gmail etc. use. They all rely on the browser polling the server at set intervals.
Web browsers really aren't set up to handle this sort of communication. The communication is a one way street where the web server is listening on a port (typically 80 or 443) for for information to be sent to it.
I just read the link on comet, and it's interesting approach, but what has to be remembered is that it is still technically being opened by the client. The server is sending code for it to execute, but the browser is ultimately in control and determines when the server communicates with it.
With today's web browsers the server can never technically execute a message being sent to it without the help of the browser. Technically you might be able to get around that by executing some Active X control on the client machine...but I haven't tried it.
You can't, HTTP is stateless. A long time ago Netscape implemented HTTP Push but it wasn't a sucess.
I'd use polling with a web service or similar; no plugin (that is Flash, Java,Silverlight) will have rights in its sandbox to use raw sockets so it'll be a waste of time trying to implement it that way.

Resources