Atmosphere / wasync

WebSockets with fallback transports client library for Node.js, Android and Java
http://async-io.org
161 stars 47 forks source link

WebSocketTransport - are ignoring the first text frame #147

Closed ricardojlrufino closed 7 years ago

ricardojlrufino commented 7 years ago

Debugging the WebSocketTransport.TextListener class, I'm noticing that it is bypassing the first message sent by the server.

My flow is this: when the client connects, it sends a message to the server requesting data, and the server responds with that data.

I see the message being received by:

Org.atmosphere.wasync.transport.WebSocketTransport.TextListener # onMessage

However the protocolReceived attribute is false

Using - wasync 2.1.4

ricardojlrufino commented 7 years ago

On server I'm using this dependencies:

<properties>
    <jersey-version>1.19</jersey-version>
    <jaxb-version>2.1</jaxb-version>
    <nettosphere-version>2.4.11-SNAPSHOT</nettosphere-version>
    <atmosphere-version>2.4.7</atmosphere-version>
    <atmosphere-extensions>2.4.3</atmosphere-extensions>
    <shiro-version>1.2.4</shiro-version>
</properties>

I had many problems upgrading nettosphere to version 3.0.0

ricardojlrufino commented 7 years ago

I found an alternative, send a PING along with the connection response

I changed in my server from

Return Response.status (Response.Status.OK) .build ();

To:

    @GET
    @Suspend(contentType = "application/json", listeners = WSEventsLogger.class)
    public Response onConnect() {
        resource.getRequest().setAttribute("lastConnectionDate", new Date());
        return Response.ok("X").build();
    }