Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support `onMessage` parsing `Schema` messages sent from client to server

See original GitHub issue

The work @endel did for issue is extremely useful for sharing Schemas between the client and server for messages that the server sends to the client, and it would be great to have that same functionality available when sending messages from the client to the server.

Currently, everyone needs to manually implement parsing JSON messages from the client, which is error-prone and a hassle. Additionally, implementing this would let us benefit from using schema-codegen to keep message schemas the same between the client and server.

It could look something like this, similar to what’s listed in

this.onMessage(MoveMessage, (client: Client, message: MoveMessage) => {
  // Handle schema-encoded MoveMessage, while benefitting from autocompletion.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

endelcommented, Aug 23, 2021

Hi @rnd256, thanks! I agree, let’s use this issue to track the progress on the documentation

rnd256commented, Aug 23, 2021

I think this is still relevant - ideally the docs would cover this helpful feature

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal: handle onMessage by message type #315 - GitHub
Hi @zgz682000, only the client-side is able to listen to Schema messages. The client-side is not allowed to send Schema messages so far,...
Read more >
HTML5 Server-Sent Events and Examples -
In this article, we'll explore simple messaging with HTML5's SSE using a Java Servlet as the server and some JavaScript code in a...
Read more >
Writing WebSocket client applications - Web APIs | MDN
Receiving messages from the server. WebSockets is an event-driven API; when messages are received, a message event is sent to the WebSocket ...
Read more >
A JSON event-based convention for WebSockets - Thoughtbot
We get a message from the server, we add it to the page. We hijack a form's submit event and send its contents...
Read more >
Chapter 5 Using Message-Driven Beans - Oracle Help Center
A client accesses a message-driven bean through JMS by sending messages to the message destination for which the message-driven bean class is the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found