Skip to content

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

Description

@FZambia

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions