Saturday, 28 September 2019

How could I update message from difference socket.io event?

I am using the api with difference event channelName1 and channelName2

//...this the realtime record
socket.on(channelName1, message => {
      console.log(channelName1, message1);
      //this return single item list in realtime`[{"price":100,"size":0.001}]`
 });

//realtime snapshot collection of records
socket.on(channelName2, message => {
   console.log(channelName2, message2);
   //this return the collection `[{"price":100,"size":0.01}, {"price":200,"size":0.02} ]`
   $('#live').text(message2)
});

I want to want to update size of message2 if I found the price":100 is present in the collection message2, so the after update message2 will

[{"price":100,"size":0.001}, {"price":200,"size":0.002} ]

anyone could you guide me how I can do this update from channelName1 to ChannelName2 data?



from How could I update message from difference socket.io event?

No comments:

Post a Comment