PatrickJS / angular-websocket

:arrow_upper_left: The missing Angular WebSocket module for connecting client applications to servers by @AngularClass
https://angularclass.github.io/angular-websocket
MIT License
1.22k stars 195 forks source link

onMessage data queue #108

Open oriko opened 8 years ago

oriko commented 8 years ago

Hi

I am using angular-websocket for my websocket implementation, when using the onMessage I can see a strange behavior, each time I am receiving my data back I can see that the onMessage is called also backward for my old data.

 dataStream.onMessage(function(message) {
                var data = JSON.parse(message.data);

 });

for example: on first msg - onMessage called 1 time data = x . on second msg - onMessage called 2 times data = x ->data = y . on third msg - onMessage called 3 times data = x ->data = y ->data=z

Is there a way to avoid the backward calls with the old data?