Looks like you have 10 bytes of framing per packet after a WebSocket has been initiated (see
https://stackoverflow.com/a/12739418). If you think 50 bytes is too much per ping, then (if you're in control of both the client and server protocols) you could create maybe something like this
which would bring you to 15 bytes and be a type that is just ignored by the server.
or
Other solution(?): Include a session parameter. This way if the connection is broken and the server sees a new WebSocket connection, it can first see if this was a previously active session and process the information accordingly. Then you would not need a ping/keep-alive mechanism. This may also cover situations where the network connection was disrupted.
{"type":"event","event":"c_p","params":{"X":"X"},"session":"SomeSortOfSessionID"}
Update: If it is a high traffic connection with pauses now and then, I would go with the ping route. If this is a low traffic connection with pauses then I would look into implementing sessions. The session information overhead may be worth it for the high traffic connections if network interruptions are common and or can wreak havoc with your communication process.