Bug 54127

Summary: WsOutbound is missing a ping method
Product: Tomcat 7 Reporter: Sean Winterberger <sean.winterberger>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 7.0.32   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: patch which adds ping functionality to WsOutbound

Description Sean Winterberger 2012-11-09 20:23:13 UTC
Created attachment 29577 [details]
patch which adds ping functionality to WsOutbound

WsOutbound currently lacks the ability to send a ping request to the client.

Attached patch creates a new method pong which takes in a ByteBuffer and passes the ping byte (0x09) to sendControlMessage which sets the opcode byte on the frame.  Refactored pong method to all call sendControlMessage as opposed to duplicate code. 

Added websocket.Constants import for OPCODE_PING/PONG.
Comment 1 Mark Thomas 2012-11-09 20:25:25 UTC
Comment on attachment 29577 [details]
patch which adds ping functionality to WsOutbound

Fix MIME type. Set patch flag.
Comment 2 Mark Thomas 2012-11-09 20:35:42 UTC
Many thanks for the patch. I had to clean it up a little:
- tabs -> 4 spaces
- remove trailing white space
- remove unnecessary (and in wrong order) import

Running the build with Checkstyle enabled would have caught all of the above. That said, they were trivial to fix.

The patch has been applied to trunk and 7.0.x and will be include in 7.0.33 onwards. Thanks again.