Skip to content

Http session isn't available from com.codeminders.socketio.server.Socket with websocket transport at least in Jetty 9.4.7 #22

@Geminist

Description

@Geminist

Http session isn't available from com.codeminders.socketio.server.Socket with websocket transport at least in Jetty 9.4.7 because of method org.eclipse.jetty.websocket.servlet.UpgradeHttpServletRequest#complete :

public void complete()
{
    request = null;
} 

As a workaround I have overridden WebsocketConfigurator#modifyHandshake :

    @Override
    public void modifyHandshake(
            ServerEndpointConfig config,
            HandshakeRequest request,
            HandshakeResponse response
    ){
        request.getHttpSession(); // it causes session "caching" in UpgradeHttpServletRequest
        super.modifyHandshake(config, request, response);
    }

But it looks like a hack and it isn't so reliable.
And more, @ServerEndpoint(value="/socket.io/", configurator = WebsocketConfigurator.class) on WebsocketTransportConnection does not allow easy override configurator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions