WebSocket client API
Andrej Golovnin
andrej.golovnin at gmail.com
Fri Sep 4 11:09:28 UTC 2015
Hi Pavel,
>> - WebSocket.onClose() should contain the close reason code.
>
> What is it useful for? Is it ok to provide it as a part of description?
>
> String description = char code + ": " + String reason
>
Please don't do that! We definitely don't want to parse it. What we
need is a method with this signature:
WebSocket.Incoming.onClose(int statusCode, String reason)
In our application an administrator may close a connection due to
server maintenance or some other reason and in this case we use an
application specific statusCode (e.g. 4001). Depending on the status
code we show the user appropriate messages and the reason submitted by
the administrator.
What we also need, is the method WebSocket.close(int statusCode,
String reason) because the client may also close the connection for
some application specific reason.
Best regards,
Andrej Golovnin
More information about the net-dev
mailing list