I am working on a chat client based on Ember.js and Strophe.js (XMPP). So far I made only very little progress because it was really hard to get a grasp of Ember.js at first. However, I have to say that my code would never have been so structured and that I feel speeding up.
So right now I have my own model classes extended from Ember.Object which receive data (stanzas in this case) via a small pubsub library from a small wrapper around Strophe.js. The next step is to send data via Strophe.js but I am not sure what the best practice would be. I see two options:
- Have the wrapper subscribe and the models publish data. Maybe even replace the pubsub library with Ember.Instrumentation. In this way other models could even listen to actions.
- Have the models call methods from the wrapper. However, I would have to expose the wrapper to all models somehow and other models wouldn’t be able to listen.
What do you say is the best way to have the models talk to Strophe.js? Also, should the controllers be able to talk to Strophe.js or should it be completely transparent through the models?
Thanks a lot, Karsten