package api import ( "fmt" "log" "net/url" "github.com/gorilla/websocket" ) type WsBot struct { Wsconn *websocket.Conn } func WebsocketBot(host string, port string, path string) WsBot { wsurl := url.URL{Scheme: "ws", Host: host + ":" + port, Path: path} conn, _, err := websocket.DefaultDialer.Dial(wsurl.String(), nil) if err != nil { log.Fatal("Failed to connect to WebSocket server:", err) } return WsBot{conn} } func Test() { fmt.Println("test") }