Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] WebSocketGeneratorRFC6455.closeOut doesn't send reason when code < 0

When a connection is closed with a message and closeCode <= 0, the message is not sent at all. This is because of the test in line 382 of


Is this intended behavior? As a user, I expected that calling connection.close(-1, "reason for closure") would populate a _javascript_ ErrorEvent with:

wasClean: false
reason: "reason for closure"

Instead, reason is "". If this is intended behavior, I think the Javadoc needs some elaboration; it reads:


public void close(int closeCode, String message)

Close the connection with specific closeCode and message.

closeCode - The close code to send, or -1 for no close code
message - The message to send or null for no message

As implemented, message is never sent unless closeCode > 0.

Back to the top