SignalR combined with Breeze

I have a project that I just installed using BreezeJS. Not knowing what is going on inside BreezeJS to the fullest, but just admitted that it works, I have my objects shown on the screen mainly from this simple command.

export function getProjects(projectsObservable, errorObservable) { return breeze.EntityQuery.from("Projects") .using(manager).execute()...then/fail. } 

Now I want to make it responsive for users who edit the same elements using signalR. This means that at this moment I call back callbacks at the end of javascript, saying that the object with guid = xxxxxxx has changed (guid is the key).

How can I connect to Breeze by updating an item without re-requesting the server and not viewing it as an update that needs to be sent back to the server. Remmeber that I just received an update from the r signal.

Should I take a different path first, is there any reason to create WebApi if I could just return the data from the signalR hub at the beginning? Would it be easy to install this using Breeze instead of WebApi?

+8
javascript signalr breeze
source share
2 answers

At IdeaBlade, we look forward to a good guide on Breeze SignalR applications.

My current thinking is that SignalR is suitable for notifying the client about changes in the data of interest, but I did not deliver the changed data to the client using SignalR . I allow the client to decide whether (or not ... or when) to receive the modified data from the server.

My reasoning is based on the notion that SignalR should be a quick and easy notification mechanism, and not a fire hose spraying a huge amount of data from customer subscribers who may or may not be ready (or want) to cope with a huge amount of data changes, on which they were superimposed.

Perhaps you can clarify why you think differently. Of course, I am open to an alternative perspective.

+12
source share

I totally agree with Ward Bell

If you're interested in how to do this : for example, in an angular application, you can subscribe to a break essence tracking mechanism, like this

enter image description here

You can then configure your SignlarR hub somewhere else to pass these changes on to all clients.

However, perhaps because of the power of breeze.js, I would not recommend it because, as Ward said, "it will be a fire hose spraying a huge amount of data from customer subscribers." Think for a moment, and think that your application will have hmmm. It allows you to tell 30 simultaneous users making transactions to present all the network traffic that it will create. It will be a bad software architecture.

The only reason you can do this is to update your dashboard, which is powered by live data, but still you need to be more concise, attentive, conscious, aware of data traffic and server usage.

  function setupEventForHasChangesChanged() { EntityManager.hasChangesChanged.subscribe(function (eventArgs) { $rootScope.$emit('dataservice.hasChangesChanged', eventArgs); }); } function setupEventForEntitiesChanged() { EntityManager.entityChanged.subscribe(function (changeArgs) { if (changeArgs.entityAction === breeze.EntityAction.PropertyChange) { $rootScope.$emit('dataservice.entitiesChanged', changeArgs); } }); } 
+4
source share

All Articles