Vertx closes websocket connection if websocket uses a subprotocol

210 views
Skip to first unread message

Oliver Rolle

unread,
Mar 13, 2014, 8:19:15 PM3/13/14
to ve...@googlegroups.com
websocket allows to define sub protocols. Netty supports subprotocols, but vertx does not.

The DefaultHttpServer implementation does not allow to use subprotocols, because on line 692 the null argument forces to have no subprotocols. If the argument is changed to "*" (wildcard) everything should work fine.

I could not make an issue on github  because I could not make an issue on the eclipse/vertx project :-(

Norman Maurer

unread,
Mar 14, 2014, 1:03:13 AM3/14/14
to ve...@googlegroups.com, Oliver Rolle
I have some proto-type to subport sub-protocols here. But I think this will not find it into Vert.x before 2.1.0 is cut.
-- 
Norman Maurer
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Norman Maurer

unread,
Mar 14, 2014, 5:59:37 AM3/14/14
to ve...@googlegroups.com, Oliver Rolle
I just polished the code and pushed it to github in an extra branch.

Maybe you can test it and let me know if this is what you want:

-- 
Norman Maurer

Oliver Rolle

unread,
Mar 14, 2014, 4:38:55 PM3/14/14
to ve...@googlegroups.com, Oliver Rolle, norman...@googlemail.com
thanks for the fast response and solution!

I tested the websockets_subprotocol branch against my problem and it works fine.

Norman Maurer

unread,
Mar 15, 2014, 3:53:57 AM3/15/14
to ve...@googlegroups.com, Oliver Rolle, Oliver Rolle
Awesome… let us see if we can get it in for 2.1.0 or not...
-- 
Norman Maurer

Oliver Rolle

unread,
May 5, 2014, 7:13:51 PM5/5/14
to ve...@googlegroups.com, Oliver Rolle, norman...@googlemail.com
Hi,

it seems that subprotocol support got broken in vertx 2.1RC3.

Background:
I write a module which is able to use the http://app.flowhub.io user interface. Its an environment to build flow based applications. It should be used as a ui for vertigo. I could modify the ui code (delete subprotocol and add binary websocket frame support), but than I have to maintain a fork of the ui. I think vertx should support both changes because it is part of the websocket standard to support subprotocols and be able to write text data onto the text channel of a websockt.


Related issue: https://github.com/eclipse/vert.x/pull/806

1. Subprotocol

In DefaultHttpServer line 691:
WebSocketServerHandshakerFactory factory =
          new WebSocketServerHandshakerFactory(getWebSocketLocation(ch.pipeline(), request), null, false,
                                               maxWebSocketFrameSize);

the null argument should be a String containing a csv containing all subprotocols.
And the subprotocol might be exposed via the HttpServer Interface, so that we are able to set the subprotocols.

2. DefaultServerWebSocket.write()
The DefaultServerWebSocket.write() (line 152) writes the data onto the binary channel, but it might be more appropriate to write String data (eg. json) onto the text channel of the websocket protocol. 

Norman Maurer

unread,
May 6, 2014, 4:12:51 AM5/6/14
to ve...@googlegroups.com, Oliver Rolle
I think this will be included in the next release. Check current vert.x master which should contain the needed changes.

-- 
Norman Maurer
Reply all
Reply to author
Forward
0 new messages