Hopefully this will be the last of my getting start questions but I can't seem to get any socket events working. I've looked at your example app and can't see the difference that's stopping it working.
In the example below I would expect that once a new list item is saved the "created" event would fire on the lists collection, but nothing is happening.
The only thing I've noticed but not sure if it's related is undefined showing at the end of my socket request i.e.
socket request: get /api/lists?where={"team":"533951b78972167e2d3c5d10"}&limit=30&watch=true undefined
var lists = new App.Entities.ListCollection;
return lists.query({
where: {
team: team.id
}
}).fetch({
socketSync: true
}).then(function() {
var listsListView = new View.Lists({
collection: lists
});
listsListLayout.on("show", function() {
listsListLayout.panelRegion.show(listsListPanel);
listsListLayout.listsRegion.show(listsListView);
});
listsListPanel.on("list:new", function() {
require(["apps/lists/new/new_view"], function(NewView) {
var newList = new App.Entities.List({
team: team.id
});
var view = new NewView.List({
model: newList
});
view.on("form:submit", function(data) {
newList.save(data).done(function() {
lists.add(newList);
view.trigger("modal:close");
var newListView = listsListView.children.findByModel(newList);
if (newListView) {
newListView.flash("success");
}
});
});
App.modalRegion.show(view);
});
});
App.sideRegion.show(listsListLayout);
return lists.on("created", function(data) {
console.log('list created');
var list = new App.Entities.List(data);
return list.fetch().done(function() {
lists.add(list);
var newListView = listsListView.children.findByModel(list);
if (newListView) {
newListView.flash("success");
}
});
});
});