Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with using external sockJS server #4

Open
matyas-igor opened this issue Oct 13, 2014 · 0 comments
Open

Problem with using external sockJS server #4

matyas-igor opened this issue Oct 13, 2014 · 0 comments

Comments

@matyas-igor
Copy link

Hi, Carl!
Your implementation of sockJS client is really awesome, but I can't use it because I can't send subscribe message.
I'm using external implementation of sockJS server (on PHP).

In javascript client code was like:

        sockjs = new SockJS('/echo');
        sockjs.onopen = function() {
            sockjs.send(JSON.stringify({subscribe: ['orders', 'deals']}));
            $('div').append('open '+ sockjs.protocol+'<br />');
        };

But I can't send it same message in java using your library.

I've tried to use something like:

            ClientBootstrap clientBootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
            SessionClient sessionClient = new SessionClient("http://localhost:8080/echo");

            WebSocketClient webSocketClient = new WebSocketClient(clientBootstrap, new URI("http://localhost:8080/echo"), sessionClient);
            ChannelFuture channelFuture = webSocketClient.connect();

            Channel channel = channelFuture.getChannel();
            webSocketClient.setChannel(channel);

            webSocketClient.send("{\"subscribe\":[\"orders\",\"deals\"]}");

But in this case I got message:

WARNING: The pipeline contains no upstream handlers; discarding: [id: 0x68cc8000, /192.168.1.107:49412 => n1.bbroyal.net/178.62.180.105:8080] EXCEPTION: java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant