|
|
@ -5,7 +5,7 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
"github.com/go-kratos/kratos/examples/ws/handler" |
|
|
|
"github.com/go-kratos/kratos/examples/ws/handler" |
|
|
|
"github.com/go-kratos/kratos/v2" |
|
|
|
"github.com/go-kratos/kratos/v2" |
|
|
|
transhttp "github.com/go-kratos/kratos/v2/transport/http" |
|
|
|
"github.com/go-kratos/kratos/v2/transport/http" |
|
|
|
"github.com/gorilla/mux" |
|
|
|
"github.com/gorilla/mux" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -13,7 +13,7 @@ func main() { |
|
|
|
router := mux.NewRouter() |
|
|
|
router := mux.NewRouter() |
|
|
|
router.HandleFunc("/ws", handler.WsHandler) |
|
|
|
router.HandleFunc("/ws", handler.WsHandler) |
|
|
|
|
|
|
|
|
|
|
|
httpSrv := transhttp.NewServer(transhttp.Address(":8080")) |
|
|
|
httpSrv := http.NewServer(http.Address(":8080")) |
|
|
|
httpSrv.HandlePrefix("/", router) |
|
|
|
httpSrv.HandlePrefix("/", router) |
|
|
|
|
|
|
|
|
|
|
|
app := kratos.New( |
|
|
|
app := kratos.New( |
|
|
|