SignalR combined with Breeze

breeze, javascript, signalr

Solution

We at IdeaBlade are looking forward to providing good guidance on Breeze apps working with SignalR.

My current thinking is that SignalR is appropriate for notifying the client of changes to data of interest but I would not deliver the changed data to the client with SignalR. I let the client decide whether (or not ... or when) to get the changed data from the server.

My reasoning is based on the view that SignalR should be a fast, lightweight mechanism for notification, not a fire hose spraying vast quantities of data at subscribing clients who may or may not be ready (or willing) to cope with a huge volume of change data forced upon them.

Perhaps you can elaborate on why you think differently. I'm certainly open to an alternative perspective.

Problem

I have a project that i right now have set up with BreezeJS. Not knowing what goes on inside BreezeJS to the full scope, but just accepted that it works, i have my items shown on screen basically from this simple command. ``` export function getProjects(projectsObservable, errorObservable) { return breeze.EntityQuery.from("Projects") .using(manager).execute()...then/fail. } ``` I now want to make it responsiveness to users that edit the same items with signalR. This means i at this point have callbacks being fired on javascript end saying that object with guid = xxxxxxx has changed(guid is the key). How can i tap into Breeze updating the item without it query the server again, nor sees it as an update that needs to be send back to the server. Remmeber that i just got the update from signal r. Should i have taken another path in the first place, is there a reason to create a WebApi if i could just could have returned the data from the signalR hub at the beginning? Would it be easy to set this up with Breeze instead of the WebApi ?

Original source