Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf protocol: consider throwing exceptions in case of non Uint8Array arguments #283

Open
FZambia opened this issue May 10, 2024 · 0 comments

Comments

@FZambia
Copy link
Member

FZambia commented May 10, 2024

centrifuge-js expects Uint8Array for data in methods in Protobuf case. When passing non-Uint8Array data is skipped by serialization layer. I guess we can throw exceptions in such cases like we currently do in Python SDK.

For example, this is an incorrect RPC call in Protobuf protocol scenario:

centrifuge.rpc("method", {"input": "hello"})

The correct one is:

const rpcRequestData = {"input": "hello"};
const binaryData = new TextEncoder("utf-8").encode(JSON.stringify(rpcRequestData));
centrifuge.rpc("method", binaryData);

Since the usage is incorrect - throwing exception seems right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant