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

Unclear how to handle custom send() messages #185

Closed
casept opened this issue Dec 15, 2024 · 1 comment
Closed

Unclear how to handle custom send() messages #185

casept opened this issue Dec 15, 2024 · 1 comment

Comments

@casept
Copy link
Contributor

casept commented Dec 15, 2024

When I send a message from my script using send() like below, I'd expect it to be parsed as a SendMessage:

send("message", data)

Instead, it gets handled as a message of type Other, in a manner where I can't access the data payload at all:

Object {"data": String("{\"type\":\"send\",\"payload\":\"message\"}"), "error": String("invalid type: string \"message\", expected struct SendPayload")}

If I try to manually construct and pass to send() a JSON object that looks like a struct SendMessage, the handler is not called at all and the messages are silently eaten:

send({type: "READ", id: 0, result: "ffff", returns: "read"}, data);

Could be that I'm using it wrong, but I can't find documentation or code samples that go beyond the trivial "just print log messages" sort of use case.

@casept
Copy link
Contributor Author

casept commented Dec 15, 2024

Seems like it's just misleading naming and we're supposed to use Other. As for accessing the binary data, that seems to have been a missing feature and I've opened #186 to address it.

@casept casept closed this as completed Dec 15, 2024
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