mardi 16 novembre 2021

Ember.j - How to update chat when a message is created in database? (firebase as database)

I'm new to ember.js and firebase. At the moment I can post messages and see them displayed in a list like this:

//templates/show-messages.hbs



<div class="container">
    <div class="chat-container">
        
        <div class="bubble">
            <h3></h3>
            <p></p>
        </div>
        
    </div>
    <ChatInput class="Input" @username="" @text=""></ChatInput>
</div>


//routes/show-messages.js

import Route from '@ember/routing/route';

export default class ShowMessagesRoute extends Route {
  model() {
    return this.store.findAll('chat-message');
  }
}

The problem is that when viewing chat in another browser, the chat window doesnt update when I post a message. Hence, the chat doesnt really update like it should.

How do I solve this? Thanks.




Aucun commentaire:

Enregistrer un commentaire