通过go建立websocket客户端,与服务端连接失败

使用go的iris建立websocket客户端,去连接一个websocket服务端,但是好像连接不成功,超时错误?(我用postman去连接服务端都能连接成功,所以应该不是服务端的问题吧)
代码是基本就是github上拷过来的,

package main

import (
    "bufio"
    "bytes"
    "context"
    "fmt"
    "log"
    "os"
    "time"

    "github.com/kataras/iris/v12/websocket"
)

const (
    endpoint              = "ws://localhost:8080/echo"
    namespace             = "default"
    dialAndConnectTimeout = 5 * time.Second
)

// this can be shared with the server.go's.
// `NSConn.Conn` has the `IsClient() bool` method which can be used to
// check if that's is a client or a server-side callback.
var clientEvents = websocket.Namespaces{
    namespace: websocket.Events{
        websocket.OnNamespaceConnected: func(c *websocket.NSConn, msg websocket.Message) error {
            log.Printf("connected to namespace: %s", msg.Namespace)
            return nil
        },
        websocket.OnNamespaceDisconnect: func(c *websocket.NSConn, msg websocket.Message) error {
            log.Printf("disconnected from namespace: %s", msg.Namespace)
            return nil
        },
        "chat": func(c *websocket.NSConn, msg websocket.Message) error {
            log.Printf("%s", string(msg.Body))
            return nil
        },
    },
}

func main() {
    ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(dialAndConnectTimeout))
    defer cancel()

    // username := "my_username"
    // dialer := websocket.GobwasDialer(websocket.GobwasDialerOptions{Header: websocket.GobwasHeader{"X-Username": []string{username}}})
    dialer := websocket.DefaultGobwasDialer
    client, err := websocket.Dial(ctx, dialer, endpoint, clientEvents)
    if err != nil {
        panic(err)
    }
    defer client.Close()

    c, err := client.Connect(ctx, namespace)
    if err != nil {
        panic(err)
    }

    c.Emit("chat", []byte("Hello from Go client side!"))

    fmt.Fprint(os.Stdout, ">> ")
    scanner := bufio.NewScanner(os.Stdin)
    for {
        if !scanner.Scan() {
            log.Printf("ERROR: %v", scanner.Err())
            return
        }

        text := scanner.Bytes()

        if bytes.Equal(text, []byte("exit")) {
            if err := c.Disconnect(nil); err != nil {
                log.Printf("reply from server: %v", err)
            }
            break
        }

        ok := c.Emit("chat", text)
        if !ok {
            break
        }

        fmt.Fprint(os.Stdout, ">> ")
    }
}

就修改了一个endpoint和dialAndConnectTimeout,问题出在

client, err := websocket.Dial(ctx, dialer, endpoint, clientEvents)

最后返回来的err长这样

img