Skip to content

(json-rpc-streams) NodeJsMessageStream drops longer messages and potentially some sent before and after #15

@ILikeRubberDuckies

Description

@ILikeRubberDuckies

index.ts line 32

readStream.on("data", (chunk: any) => {
	const str = chunk.toString("utf8");
	const parts = str.trim().split("\n"); // todo improve. Yes, please do!
	for (const p of parts) {
		const obj = JSON.parse(p) as Message;
		this.onMessage(obj);
	}
});

This does not work when the message is longer than the chunk.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions