Skip to content

Commit a27ba48

Browse files
committed
Document how to use PerMessageDeflateExtension#getCompressionRatio()
The PerMessageDeflateExtension#getCompressionRatio() API needs to be called on the class instance used by the library. Add Javadoc explaining how that instance can be retrieved.
1 parent 4da0258 commit a27ba48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/org/java_websocket/extensions/permessage_deflate/PerMessageDeflateExtension.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ public void setServerNoContextTakeover(boolean serverNoContextTakeover) {
172172
* above 1, look into increasing the compression level or the threshold. If that does not help,
173173
* consider not using this extension.
174174
*
175+
* <p>IMPORTANT: This API must be called on the class instance used by the library, NOT on the
176+
* instance which was handed to the library! To get this class instance, retrieve it from the
177+
* library e.g. via ((Draft_6455) webSocketClient.getConnection().getDraft()).getExtension().
178+
* Make sure to apply class instance checks, as the extension may not have been negotiated.
179+
*
175180
* @return the overall compression ratio of all incoming and outgoing payloads
176181
*/
177182
public double getCompressionRatio() {
@@ -568,6 +573,7 @@ public IExtension copyInstance() {
568573

569574
@Override
570575
public void reset() {
576+
super.reset();
571577
isCompressing = false;
572578
isDecompressing = false;
573579
compressedBytes = 0;

0 commit comments

Comments
 (0)