2022-02-09 15:53:51 +08:00
2021-11-29 16:49:53 +08:00
2015-05-04 16:43:19 +08:00
2021-11-29 16:49:53 +08:00
2021-11-29 16:49:53 +08:00
2019-03-26 15:58:01 +08:00
2015-05-03 22:57:59 +08:00
2019-03-26 15:58:01 +08:00
2022-02-09 15:53:51 +08:00

websocket middleware for Tango

** IN DEVELOPMENT, API WILL CHANGED FREQUENTLY **


type Action struct {
    websocket.Message
}

func (w *Action) Get() {
    w.OnConnected(func(ws *websocket.Conn, sender chan []byte) {
        fmt.Println("on connected")
    }).OnReceived(func(ws *websocket.Conn, data []byte) {
        fmt.Println("on received", string(data))
    }).OnClosed(func(ws *websocket.Conn) {
        fmt.Println("ws closed")
    }).ListenAndServe()
}

func main() {
    tg := tango.Classic()
    tg.Use(websocket.New())
    tg.Get("/", new(Action))
    tg.Run()
}
S
Description
No description provided
Readme 2.4 MiB
Languages
Go 89.3%
HTML 10.7%