Skip to content
Advertisement

Atmosphere responses, broadcasts do not call javascript onMessage handler

I’m working with atmosphere trying to get the simple base implementation using atmosphere 2.0.3 tomcat 7.0.42 running locally in my eclipse environment (also connecting from external machine to see traffic with wireshark). The problem I am experiencing is no matter what transport I use, websocket, sse, polling, long-polling, the broadcast response never seems to get to the client and the response.OnMessage handler is never invoked. I receive no exceptions during runtime, and I have tried with firefox/chrome/and IE. I have also used wireshark and I see a packet after the post of a chat message that contains my message response: “HTTP – Continuation or non-HTTP traffic” and in the packet data I can see the outgoing message to the client, so it appears the server side is working correctly. The initial connection to server is established and the js onOpen handler is invoked as expected.

The work I am doing is based largely on the atmosphere sample chat application. If anyone has any suggestions, I would appreciate it. Might also be worth mentioning, that I added in the actual chat handler, js, and html page from the atmosphere sample and it also does not behave and the onMessage js handler is not invoked in that either, so I’m thinking it is a configuration issue.

web.xml

JavaScript

POM.xml

JavaScript

Server side code:

JavaScript

Client side Javascript (has been tried with polling/long-polling/sse/websockets and all successfully connect initially and call the OnOpen handler after initial connection:

JavaScript

Advertisement

Answer

You must install the TrackMessageLengthInterceptor if you set the trackMessageLength : true on the client side. So add it to your AtmosphereHandlerService’s interceptor list.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement