Skip to main content

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

http://tools.ietf.org/html/rfc6455#section-7.4

afaik -1 is not a valid close code, and only valid close codes can have a reason

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx


On Tue, Oct 30, 2012 at 3:22 PM, Brandon Mintern <mintern@xxxxxxxxxxx> wrote:
> 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
> WebSocketGeneratorRFC6455.java:
>
> _outbound.addFrame((byte)FLAG_FIN,WebSocketConnectionRFC6455.OP_CLOSE,bytes,0,code>0?bytes.length:0);
>
> 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:
>
>
> org.eclipse.jetty.websocket.WebSocket.Connection
>
> public void close(int closeCode, String message)
>
> Close the connection with specific closeCode and message.
>
> Parameters:
> 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.
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>


Back to the top