Skip to content

Fix JS example to receive eventbus bridge messages#1

Open
jmoscato wants to merge 1 commit intomasterfrom
jsexample-patch-1
Open

Fix JS example to receive eventbus bridge messages#1
jmoscato wants to merge 1 commit intomasterfrom
jsexample-patch-1

Conversation

@jmoscato
Copy link
Owner

There appears to be an error in the code for the example to send and receive client side messages in Javascript over the eventbus bridge. As written, every message logged to the console is null. In order to make the example work I needed to add another parameter before the 'message' parameter so that it matches the source code for the onmessage function in vertx-eventbus.js on lines 131 and 141. There, the onmessage function has two calls which pass two arguments to a handler, and the arguments are '(null, json)'. I believe the first argument 'null' is to indicate an error has not occurred.

When my client code matched the example in the Asciidoc and only had one argument, the json message was always arriving as null. My proposed fix to the example code allows the proper json message to be received by my client's handler.

There appears to be an error in the code for the example to send and receive client side messages in Javascript over the eventbus bridge. As written, every message logged to the console is null. In order to make the example work I needed to add another parameter before the 'message' parameter so that it matches the source code for the onmessage function in vertx-eventbus.js on lines 131 and 141. There, the onmessage function has two calls which pass two arguments to a handler, and the arguments are '(null, json)'. I believe the first argument 'null' is to indicate an error has not occurred.

When my client code matched the example in the Asciidoc and only had one argument, the json message was always arriving as null. My proposed fix to the example code allows the proper json message to be received by my client's handler.
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

Successfully merging this pull request may close these issues.

1 participant