How signalr implements distributed chat

Source: Internet
Author: User

This is the rebirth of my blog. I 've been busy over the last few months with projects like jabbr, signalr and
Other stuff. With the upcoming release of signalr 0.5, I thought it 'd be good to write a blog post that touches on some of the things we did.

Webfarm support

There's a lot of confusion as to what webfarm support means in signalr. This is an FYI, signalr 0.5 will not automatically make your application work on azure with zero effort. signalr
Needs a way to communicate between instances of your webserver, in 0.5 we implemented 2 of those providers on nuget (Message buses ):

  1. Signalr. windowsazureservicebus-Http://vasters.com/clemensv/2012/02/13/SignalR+Powered+By+Service+Bus.aspx (blog post
    Slightly outdated but information is relevant ).
  2. Signalr. redis-Redis message bus implementation for signalr-https://github.com/SignalR/SignalR.Redis

When deciding to make signalr work in a webfarm, You'll have these 2 options. We're re going to continue improving them as well as implement solutions on top of popular message buses like
Nservicebus and lower fidelity solutions built on top of SQL qns and possibly SQL Server service broker.

This wasn't the only hurdle to making signalr work in webfarms, there were some nasty bugs that caused some bad behavior that we fixed:

  1. Disconnect communications Communications Administration SS webfarms
  2. Load balancer idle timeout in azure.

Fixing disconnect in webfarms was the most important issue to fix. Before signalr 0.5rc, disconnect in a webfarm (using service bus or redis) cocould fire for the same client multiple
Times. this is more obvious when using longpolling and load balancing happens between Web Server instances. if you had control of your LB, you cocould affinitize clients to a server so you 'd never see this behavior, but I'm gglad to say we got this fixed.

For Load balancer idle timeouts (especially on azure), we support keep-alive. You can now tell signalr to send an empty packet on a specific time interval. This will fend off nosy Network
Devices that like to kill idle connections waiting for data. This is especially important for things like server sent events and forever frame transports.

Mono support

In the 0.4 release, signalr only "worked" When self hosted on mono so I spent time making signalr work nodes ss the Board (Asp. net and all ). when I say work, I mean both the client and
The server. You can now literally clone signalr onto your osx (I didn't try Linux) box and runMakeAnd get a successful build (see the readme for more details). This wasn't a simple task as I had to make changes to the nuget targets File
So that package restore worked on mono.

If you're using mono develop, open signalr. Mono. sln. You can run the samples as you wowould normally. Here's a glimpse of the chat demo running:

 

Not much time was spent optimizing and tuning specifically for mono but in the future we'll have time to do that.

Jsonp longpolling support (xdomain)

This feature wasn't planned for 0.5 but thanks to an awesome contribution from codeputty, this became a reality.

Dynamic hubs implementation

Contributor pszmyd was trying to build better integration between signalr and orchard and ended up adding infrastructure
To signalr to decouple hubs from types (system. Type). This is a great example of why I love OSS development (scratch your own itch ).

Continuous integration and nuget Server

We finally got a CI Server Setup on codebetter's teamcity instance. You can view signalr here http://teamcity.codebetter.com/project.html? Projectid = project188.
The CI also builds packages and pushes them to our myget feed. if you want to live on the bleeding edge but don't want to build from source, you can configure nuget to point to http://www.myget.org/F/signalr/ (make
Sure you use the-pre flag or selectInclude prerelease in the dialog).

 

0.5 release

Help us test the RC now on nuget! (Http://signalr.net/releases/v0584.html). We're reserving this week
For any bugs that we consider ship stoppers.

What's next

We're re going to continue improving signalr. Future releases will focus on some of the following:

  • Performance improvements
  • In the box websockets support for windows8
  • Windows 8. Net Client
  • . Net micro framework Client
  • Web API host
  • Build time hubs. js generation (instead of runtime ).
  • Better network availability handling
  • Better mobile support (optimized for battery life)
  • Web forms Control

... And much more! Check the issue backlog for details on what
Else we 've got planned for upcoming releases.

Come talk with us

We're all always around in the signalr room on jabbr. Come say hi!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.