I observe @OnClose is called on the server-side which seems correct, not
@OnError.
On the JavaScript client, onClose is called. How do I access the error
code ?
function onClose(evt) {
console.log(evt.data);
}
prints:
Undefined
How do I get the exact error code ?
Arun
On 4/13/13 4:40 PM, Pavel Bucek wrote:
> Yes, it is.
>
> onClose with appropriate close code ( 1009) will be called on client
> side, onError will be called on server endpoint only.
>
> Pavel
>
> On 4/14/13 1:18 AM, Arun Gupta wrote:
>> For a WebSocket endpoint defined as:
>>
>> @OnMessage(maxMessageSize=6)
>> public String echoText(String data) {
>> return data;
>> }
>>
>> If a message of size of 7 bytes is sent, then the following exception
>> is thrown on the server-side:
>>
>> SEVERE: org.glassfish.tyrus.core.MessageTooBigException: Message
>> too long; allowed message size is 6 bytes. (Current message length is
>> 7 bytes).
>> at
>> org.glassfish.tyrus.core.SessionImpl.checkMessageSize(SessionImpl.java:377)
>> at
>> org.glassfish.tyrus.core.SessionImpl.notifyMessageHandlers(SessionImpl.java:398)
>> at
>> org.glassfish.tyrus.core.EndpointWrapper.onMessage(EndpointWrapper.java:490)
>> at
>> org.glassfish.tyrus.server.TyrusEndpoint.onMessage(TyrusEndpoint.java:174)
>>
>> But onError is not invoked on the client-side.
>>
>> Is that the expected behavior ?
>>
>> Arun
>>
>
--
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta