rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

This component does not make use of reactive programming #150

Closed ghost closed 4 years ago

ghost commented 4 years ago

It does polling and behaves in strange ways. When it gets passed a subscription of the messages, it resubscribes and polls the values. This is an extremely unwanted side effect. The subscription is a subscription for a reason. It emits values continuously. Resubscribing in an interval is an extreme anti-pattern. It treats subscriptions like a wrapper for a promise. Take other alternatives like for example Kendo Chat:

<kendo-chat
        [messages]="feed$ | async"
        [user]="user"
        (sendMessage)="sendMessage($event)" />

It subscribes to the messages and updates the UI when it receives a new event. It does not do the polling nonsense.