You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Ah, I was using it to add some meta data to each WebSocket (by extending WebSocketImpl) for both client and server. This was easier to implement than a WeakHashMap, and the usage of abstract factories is in my opinion cleaner.
I would prefer not to lose abstract factories, but I can use a WeakHashMap if needed (the performance difference would be probably be minor in my case).
I would also be helped by a simple empty Object reference I can use to store stuff in, but that might be considered less clean.
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.
The text was updated successfully, but these errors were encountered: