kataras / kataras/iris

[BUG] mvc websocket can't work

Open
#1,764 0 comments 0 reactions 1 assignee Claimed by @kataras View on GitHub
🐞 type:bug
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

[https://github.com/kataras/iris/blob/master/_examples/mvc/websocket/main.go
](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:

```go
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")))
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.