jeudi 16 avril 2015

PubNub Chat: Which sorting channels based on which is most recently updated

I am using PubNub to create a Chat. Each chatroom is a PubNub channel. The challenge now is: how do I sort my channels such that channels with most recent posts should be on top.


I can think on 2 possibilities:



  • Server will listen to all channels, when a message is received, it logs it. So a chatroom model might look like {id, name, users, lastUpdate}

  • Everytime message is posted, app will also call server to pass in that message


Both methods doesnt seem to correct? Is there a better way? The first will require the server to listen on all channels. The second will require server to handle a request for each message.


Aucun commentaire:

Enregistrer un commentaire