pocesar / node-jsonrpc2

JSON-RPC 2.0 server and client library, with HTTP (with Websocket support) and TCP endpoints
Other
105 stars 41 forks source link

JSON RPC using TCP, with a separator NULL character #56

Open sbendt opened 3 months ago

sbendt commented 3 months ago

I have an implementation, where the communication protocol is based on JSON RPC. The implementation is a little different, since there is a "separator character" (0x00/NULL) between the messages being received and transmitted.

Is it possible to extend the existing JSON RPC TCP implementation to parse/ignore the separator char when receiving and inject it after transmitting messages?

pocesar commented 3 months ago

@sbendt not without a code change. the event emitters (Socket / Net) aren't exposed, so you can't use a Transform stream to pipe the answer, cork the stream until you see a null character, then uncork it.

sbendt commented 3 months ago

@pocesar thank you for the prompt reply. Ill consider writing a one-off for this, or maybe fork your repo - if that is okay?

pocesar commented 3 months ago

@sbendt sure, be my guest 😃