javalin / javalin

A simple and modern Java and Kotlin web framework

Home Page:https://javalin.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty routeRoles in wsBeforeUpgrade if it is a websocket route

yaskor opened this issue · comments

Actual behavior (the bug)

I have implemented a wsBeforeUpgrade handler. When the handler is executed and I try to access the routeRoles, I always get an empty list even though I have specified roles.

Expected behavior
When the handler is called, one should be able to access the routeRoles that have been defined instead of getting an empty list.

To Reproduce

        config.router.apiBuilder(() -> {
            ws("/ws/client", wsConfig -> {
                wsConfig.onConnect(this::onConnect);
                wsConfig.onMessage(this::onMessage);
                wsConfig.onError(this::onError);
                wsConfig.onClose(this::onClose);
            }, AUTHENTICATED); //<- routeRole is defined
        });
        ).wsBeforeUpgrade(context -> {
            var routeRoles = context.routeRoles();
            //routeRoles <- are empty
        })

Thanks @yaskor, I'll have a look in the weekend!

Should be fixed now!

Great! Thank you