iris
iris copied to clipboard
[BUG] mvc websocket can't work
https://github.com/kataras/iris/blob/master/_examples/mvc/websocket/main.go
I referenced this example and it didn't work. I copied the code in the example and it didn't work. Also need this is the expired example.
this's go.mod from my project:
module xxx
go 1.14
require ( github.com/gorilla/websocket v1.4.2 github.com/kataras/iris/v12 v12.2.0-alpha2.0.20210427211137-fa175eb84754 github.com/kataras/neffos v0.0.18 )
client code:
func TestUserNotifyCtrl_OnNamespaceConnected(t *testing.T) {
cli, _, err := websocket.DefaultDialer.Dial("ws://localhost:8080/websocket", nil)
if err != nil {
t.Fatal(err)
}
defer cli.Close()
fmt.Println(cli.WriteMessage(websocket.TextMessage, []byte("hello")))
}