In client.ts chunk is buffer it is not a string so the code below errors out. Also the regex results in a JSON string that is not properly formatted see suggested changes at bottom.
response.message.addListener('data', (chunk) => { let data: Responses.SubscribeChunkData; try { data = JSON.parse(chunk.replace(/^event:\s*/, '"event": "').replace(/\s*data:\s*/, '", "data": ')).data; } catch (error) { throw new Error(error); }
Changing FROM
data = JSON.parse(chunk.replace(/^event:\s*/, '"event": "').replace(/\s*data:\s*/, '", "data": ')).data;
TO
data = JSON.parse(chunk.toString().trimEnd().replace(/^event:\s*/, '{"event": "').replace(/\s*data:\s*/, '", "data": ').concat('}'));
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In client.ts chunk is buffer it is not a string so the code below errors out. Also the regex results in a JSON string that is not properly formatted see suggested changes at bottom.
response.message.addListener('data', (chunk) => { let data: Responses.SubscribeChunkData; try { data = JSON.parse(chunk.replace(/^event:\s*/, '"event": "').replace(/\s*data:\s*/, '", "data": ')).data; } catch (error) { throw new Error(error); }
Changing FROM
data = JSON.parse(chunk.replace(/^event:\s*/, '"event": "').replace(/\s*data:\s*/, '", "data": ')).data;
TO
data = JSON.parse(chunk.toString().trimEnd().replace(/^event:\s*/, '{"event": "').replace(/\s*data:\s*/, '", "data": ').concat('}'));