How to subscribe two infinite Flux and block indefinitely?

30 Views Asked by At

I'm using reactor websocket. I'm using it as sugested in documentation. I have callback for incoming messages and has nothing to send.

    return client
            .websocket()
            .uri(url)
            .handle((inbound, outbound) -> {
                inbound.receive()
                        .subscribe(webSocketMessageCallback::onMessage);
                return outbound
                        .neverComplete();
            })
            .blockLast();

This approach work until I want to subscirbe into another URI. Thread waits because blockLast() return no value so it don't execute another lines of code - I can't call code responsible for another websocket call.

Is there any other apporach than just execute this in seperate Thread?

0

There are 0 best solutions below