forked from hidevopsio/hiboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
websocket.go
32 lines (25 loc) · 798 Bytes
/
websocket.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package controller
import (
"hidevops.io/hiboot/examples/web/websocket/service"
"hidevops.io/hiboot/pkg/app"
"hidevops.io/hiboot/pkg/at"
"hidevops.io/hiboot/pkg/starter/websocket"
)
type websocketController struct {
at.RestController
register websocket.Register
}
func newWebsocketController(register websocket.Register) *websocketController {
return &websocketController{register: register}
}
func init() {
app.Register(newWebsocketController)
}
// Get GET /websocket
func (c *websocketController) Get(handler *service.CountHandler, connection *websocket.Connection) {
c.register(handler, connection)
}
// GetStatus GET /websocket/status
func (c *websocketController) GetStatus(handler *service.StatusHandler, connection *websocket.Connection) {
c.register(handler, connection)
}