feat: update WebSocket client initialization to use dynamic server address from configuration
This commit is contained in:
3
main.go
3
main.go
@@ -4,6 +4,7 @@ import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"git.lxtend.com/qqbot/config"
|
||||
"git.lxtend.com/qqbot/service/exec"
|
||||
"git.lxtend.com/qqbot/sqlite3"
|
||||
wsclient "git.lxtend.com/qqbot/ws_client"
|
||||
@@ -23,7 +24,7 @@ func main() {
|
||||
go func() {
|
||||
const reconnectDelay = 5 * time.Second
|
||||
for {
|
||||
client, err := wsclient.NewWebSocketClient("ws", "localhost:3001", "")
|
||||
client, err := wsclient.NewWebSocketClient("ws", config.ConfigManager.GetProperty("napcat_srv"), "")
|
||||
if err != nil {
|
||||
log.Printf("WebSocket连接失败: %v, %v 后重试", err, reconnectDelay)
|
||||
time.Sleep(reconnectDelay)
|
||||
|
||||
Reference in New Issue
Block a user