PDA

View Full Version : Resin and Websocket on Atmosphere


survivant
06-17-2010, 01:19 PM
Hello, I'm working to port Resin websocket on Atmosphere framework.

We are having few problems when we try to write response to the client.

#1 - The first problem that we had is a IllegalStateException when writting.

In Atmosphere we are doing this :

@Override
public void write(byte frame, String data) throws IOException {
context.getOutputStream().write(0x00);
context.getOutputStream().write(data.getBytes());
context.getOutputStream().write(0xff);
context.getOutputStream().flush();
}

it crash at the first line. (is it because in HttpServletRequestImpl.startWebSocket you are wrinting headers into response and it's commited before calling the onWrite ?)

#2 - On my computer the close is always call before the write method.

SocketLinkListener Thread is looking for available byte to read, and get -1 after the first read. (the first loop it reads 18 chars (in my test)).

we setted the timeout at 120 000 but in this SocketLinkListener

if (_isKeepaliveSelectEnable) {
timeout = getBlockingTimeoutForSelect();
}

overide the value to 1000.

my question is how can I skip the validation if I want to suspend the Websocket connection ?

We are testing with the Atmosphere-websocket-chat example.

if we run in debug mode.. we will be able to see the the welcome message sent by the server when we join the chat, but as soon as we resume SocketLinkListener it will get -1, and call onClose.

I hope that you can help us to put Resin on Atmosphere.

You can contact us by twitter too. @survivant or @atmo_framework

thanks

ferg
06-17-2010, 07:52 PM
Thanks. I'll need to check on that.

I assume the object with the context is a per-request object?

survivant
06-17-2010, 07:59 PM
good question, not sure. I will get back to you on that one.

you can check our ResinWebSocket implementation on Atmosphere here

this class handle the service() that will take action and call Resin's websockets
http://github.com/jfarcand/atmosphere/blob/resin-support/modules/cpr.resin/src/main/java/org/atmosphere/container/ResinWebSocketSupport.java

this class will handle the start,read,write,close calls from Resin's websockets
http://github.com/jfarcand/atmosphere/blob/resin-support/modules/cpr.resin/src/main/java/org/atmosphere/container/ResinWebSocketServletRequest.java

survivant
06-22-2010, 07:43 PM
I hope we could include Resin in the supported container for the next Atmosphere release this summer.

thanks

survivant
06-25-2010, 12:22 AM
here the application you have to make it works on Resin 4.

works on other WebSockets Webservers.

you can download the war from here : http://www.mediafire.com/file/k1nmvnggz1g/atmosphere-websocket-chat.war

just deploy that.

smart61
03-01-2013, 11:47 PM
I really need Atmosphere on Resin 4.x including websockets support. What is the status of this port?

Yttesen
04-04-2014, 05:58 AM
Any news on websocket support for Atmosphere?