angular - Implementing "Someone is typing..." functionality in chat application using firebase cloud pub/sub -
i have ported web version of friendlychat example angular 4 suite. can see mine live over here , appears working okay... shall publish opensource shortly.
now want implement feature such when user starts typing in realtime, user b should see "user typing...." message. , when user stops typing message should disappear. obviously, user shouldn't see message if himself typing.
i considering having object in db so:
{ "istyping":true, "fromdevicetoken": "xxxx" }
... , altering istyping
field using firebase realtime.
any better ideas how can achieve this? comments/improvements?
my main question is,
can firebase cloud pub/sub trigger used without persisting typing state in db .. if so, how?
you try this:
this.messageinput.onkeyup = function(){ when user starts typing update database , set istyping true. dont forget check if istyping set true not update every time user presses key }
sample got here
Comments
Post a Comment