vertx.io (3.0.0) websocket not working

Working with Vertx.io version 3.0.0 I'm trying to make a webserver communicate with the client over websocket.

Here is how the Vertx websocket is created in Xtend (Java)

val sockJSHandler = SockJSHandler.create(vertx);
val options = new BridgeOptions() => [
    inboundPermitted = #[new PermittedOptions() => [
        addressRegex = '/*'
    ]]
    outboundPermitted = #[new PermittedOptions() => [
        addressRegex = '/*'
    ]]
]
sockJSHandler.bridge(options, [ be |
    println(be.type)
    if (be.type == "SEND") {
        println(be.rawMessage.getString("address"));
        bus.send(be.rawMessage.getString("address"), be.rawMessage.getJsonObject("body"), [handler | 
            println(handler.result.body);
            if(handler.succeeded){
                handler.result.reply(handler.result.body);
                be.complete(true);
            } else {
                be.complete(false)
            }
            return
        ]);

    } else {
        be.complete(true);
        return 
    }

The problem I have is that the websocket never receive the response from the server. When I look into the network tab in the developper tool the request stay pending. The code reaches the if(handler.succeeded) with true.

What am i missing?

Answers


in this current case the regex is not good it should be .* and not /*

val options = new BridgeOptions() => [
   inboundPermitted = #[new PermittedOptions() => [
        addressRegex = '.*'
    ]]
    outboundPermitted = #[new PermittedOptions() => [
        addressRegex = '.*'
    ]]
]

And that fixes the issue.

Note that vertxbus-2.1.js received an error but did nothing with it.


Need Your Help

Regular Expression in R with a negative lookbehind

regex r negative-lookbehind

So I have the following data, let's say called "my_data":