java - Pubnub channel group history -
i have gone through pubnub channel group design pattern, http://scalabl3.github.io/pubnub-design-patterns/2015/08/11/advanced-channel-groups-friend-lists-status-feed-and-presence.html
but still stuck doubts implementing group chat
consider have groups gp1,gp2
gp1--a,b,c (members) gp2--a,d,e (members)
- here need subscribe 2 groups,if 2 need add in both ? or 1 group abcde filtering
- how group history single api call (assuming if gp1 has more 100 friends)
thanks
the post referring wrote pattern creating shallow friend graphs , status feeds, can adapt chats pretty easily.
for chat, can learn patterns here: http://scalabl3.github.io/pubnub-design-patterns/2015/03/05/inbound-channel-pattern.html
if group chats have small groups, inbound pattern works well, i'd less 5-7 people in group chat. not work larger groups, ex. 50 people, because publishing every users' inbound channel every chat message send. in case of larger groups, group chat should have it's own channel. correct, if participate in large number of large group chats have retrieve history on each, each 1 being api call. if chats more 1-1 or small group, inbound pattern makes simpler history.
merging both patterns means use cg-user-[uid]-status-feed (also might want call different, naming convention can own of course, maybe cg-user-[uid]-chats), put in inbound channel + larger group chats channels.
history still on per channel basis, history on inbound 1-1 or small group chats, , history on channels larger group chats.
more question:
gp1 , gp2 both small groups, it's simpler have chat messages sent each user, via inbound channel, in each individual group, in json payload include metadata like:
message gp1 user { group_chat: "gp1", from: "a", to: "a,b,c", timestamp: 1443112089, message: "hey guys, morning" } message gp2 user e { group_chat: "gp2", from: "e", to: "a,d,e", timestamp: 1443112192, message: "i'm going afk bit, time gym" }
this message published 3 times, 1 each of inbound channels users [gp1: a,b,c, gp2: a,d,e]. metadata have information need in ui can make sure put received message right ui container, i.e. group chat gp1 , gp2.
if have more questions, let me know...
Comments
Post a Comment