Write your Websocket message routing like http route handler.
Use the JSON RPC Specification
go get github.com/darmawan01/ws-wrapper
engine := gin.Default()
router := engine.Group("/api")
/* Register websocket route */
router.GET("/ws", func(ctx *gin.Context) {
/* Websocket wrapper handler */
ws.WebsocketHandler(ctx.Writer, ctx.Request)
})
ws.RegisterChannelHandler("public/health", h.healthCheck)