In my Ember app, I get notifications from websocket. When websocket receives a message (encoded as JSON), I want to push it to the repository.
Here is my code:
console.log('About to normalize', data); var normalizedData = this.store.normalize('message', data); console.log('About to push', normalizedData); this.store.push('message', normalizedData);
and normalizedData are ultimately the exact same values, something like this:
{"message":{"id":1,"chatroom":1,"player":1,"content":"A message"}}
And calling the push method raises this error:
Error: Assertion Failed: Expected an object as `data` in a call to `push`/`update` for message , but was {"message":{"id":1,"chatroom":1,"player":1,"content":"31232132113"}}
I do not know what is wrong. When Ember receives a specific message from the server, it receives the same kind of JSON and Ember Data that does it well. When it comes from a website and you need to click it, it will work.
Update
I tried using pushPayload as suggested in the comments. This still does not work. I get these messages:
"WARNING: there is" 0 "in the payload, but the model was not found for model name" 0 "(model name is allowed using arkipel @serializer: -rest: .typeForRoot (" 0 "))"
"WARNING: meets" 0 "in the payload, but the model was not found for model name" 1 "(resolved model name using arkipel @serializer: -rest: .typeForRoot (" 1 "))"
"WARNING: there is" 0 "in the payload, but the model was not found for model name" 2 "(model name is allowed using arkipel @serializer: -rest: .typeForRoot (" 2 "))"
It goes up to number 67, and then continues to go with words like fmt, camelize, htmlSafe ... I'm pretty simple data - it's just a string representing JSON.