Websocket ping pong: Is it done behind the scenes are do we need to schedule it ourselves?

293 views
Skip to first unread message

and...@entangledmedia.net

unread,
Oct 27, 2015, 6:49:39 PM10/27/15
to vert.x
Hello all,

I'm using websockets to communicate between a client and a server. Does vertx handle the ping pong keep alive stuff behind the scenes? Or do I need to create and handle my own dead connection detection and keep alive system?

Thanks,

Andrew

Clement Escoffier

unread,
Oct 28, 2015, 3:06:01 AM10/28/15
to ve...@googlegroups.com
Hi,

It’s done for you. To be notified when the socket is closed, just set a closeHandler on the ServerWebSocket object.
If you need to know what kind of frame is received (continuation for example), use the frameHandler callback, while to just get the content, use the handler callback.

If you are using vertx-web, you may want to look at the sockJS bridge. It makes the interaction with the web sockets easier as it 1) creates a bridge between the web sockets and the event bus, 2) degrades smoothly if the browser does not support web sockets.


Clement
--
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.
Visit this group at http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/25f9e4b5-7a2c-460f-8524-0cfe4cb952f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

and...@entangledmedia.net

unread,
Oct 28, 2015, 12:17:02 PM10/28/15
to vert.x
Awesome. Thanks! -- Andrew

and...@entangledmedia.net

unread,
Oct 28, 2015, 12:20:41 PM10/28/15
to vert.x
r/ SockJS: actually for my uses the low level websocket is perfect, but SockJS looks interesting. -- Andrew


On Wednesday, October 28, 2015 at 1:06:01 AM UTC-6, clement escoffier wrote:
Reply all
Reply to author
Forward
0 new messages