Skip to content

WebSocketClient uses wsfactory in the constructor before setting is possible (regression) #208

Closed
@Joris-van-der-Wel

Description

@Joris-van-der-Wel

WebSocketClient uses wsfactory in its constructor (https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/client/WebSocketClient.java#L109), however an instance of WebSocketClientFactory can not be passed in the constructor.
There is only a setter called setWebSocketFactory (https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/client/WebSocketClient.java#L389), which can of course only be called after the constructor has run.
This causes WebSocketClient to always use the default constructor (https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/client/WebSocketClient.java#L72)

I am not sure what the best solution would be. Break the API again and add WebSocketClientFactory to the constructor and remove setWebSocketFactory? (which is what I am doing temporarily).

Or defer the calls to the factory until after the constructor somehow?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions