Websocket support in Web Application Deployment?

25 views
Skip to first unread message

tec...@gmail.com

unread,
Feb 8, 2016, 12:11:08 PM2/8/16
to membrane-monitor
I have my app running using the 1st deployment, but not the 2nd deployment.  It seems the websocket is not supported in the 2nd deployment.  Please confirm or I did something wrong?

1. Embedding Membrane Service Proxy into Java Applications

2. Membrane Service Proxy Web Application Deployment
http://www.membrane-soa.org/service-proxy-doc/4.0/router-war.htm

Here is my proxy setting:

            <serviceProxy port="8080" >
                <interceptor refid="MyInterceptor" />
                <rewriter>
                    <!--map from="/myapp(/.*)" to="$1"/-->
                    <map from="/myapp/\w*(/.*)" to="$1" />
                </rewriter>
                <webSocket />
                <target host="192.168.1.3" port="9000"/>
            </serviceProxy>

When the code tries to forward websocket request, I got the cast exception error.

In the debugger, I see the getHandler() returns com.predic8.membrane.servlet.embedded.HttpServletHandler and it tries to cast it to com.predic8.membrane.core.transport.http.HttpServletHandler, which is not compatible (cast exception).

public class HttpClient {

public static void setupConnectionForwarding(Exchange exc, final Connection con, final String protocol, StreamPump.StreamPumpStats streamPumpStats) throws SocketException {
final HttpServerHandler hsr = (HttpServerHandler)exc.getHandler();
String source = hsr.getSourceSocket().getRemoteSocketAddress().toString();
String dest = con.toString();

Any idea how to resolve this?  I really want the 2nd deployment scenario, because I have another app deployed in the same J2EE container that works with this app.

Thanks,
Denny

Tobias Polley

unread,
Feb 8, 2016, 3:24:06 PM2/8/16
to membrane-monitor, tec...@gmail.com
Hi Denny,

unfortunately, as you correctly diagnosed, Membrane currently does not support the combination of the webSocket and WAR deployment features.

For this to work, there are a few components missing
* actually parse and reassemble WebSocket frames (in the standalone Java deployment)
* use the JSR 356 API to accept incoming websocket connections (in the WAR deployment)
* enable combination of these two features

Number 1 alone is a bit of work, but something we are looking at and where contributions are welcome.

Best
Tobias
Reply all
Reply to author
Forward
0 new messages