WebSocket JSON Organizer
This module provides a function to parse JSON Objects from multiple (or single) JSONs in a single string chunk. It is useful such when a WebSocket on message event is supposed to be fired only for a single JSON message however some times it contains more than one JSON.
Use this function as pre-processor for messages in WebSocket
How to use
This module can be used in NodeJS or Browser (AMD) environment. In order to use the function, just require it.
Install
npm i ws-json-organizer --save
Usage
var parseEachJSON = ; { ; { if err // use setTimeout for not to break whole flow for other future messages return ; //perform your own logic such as the one below for var i = 0; i < this$pendinglength; i++ if this$pendingi1seq == jsonObjrequest_seq this$pending; break; if !this$attached this$beforeAttachMessages; this; }}