Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Updating models with websocket service

$
0
0

@Joshua_Jenkins wrote:

Currently I’m subscribing to a websocket subscription in setupController which adds a subscription handler that updates the model.

I figured it should be in a service so it can be more modular. I moved the code to a service but then I can’t access the model because of the async data. Previously I waited for the nested relationship data to come through with .then() then started updating the data.

It would be nice if it was like this:

  setupController: function(controller, model) {
    this.get('websocket').subscribe(model);
  }

(The model contains the relevant data for which websocket channel to subscribe to)

It would be great if I can just inject the service and tell it what model to update via the websocket subscription. There may be multiple models with different subscriptions in a route.

Honestly I don’t know if I’m going about it the right way.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles