Browse Source

feat: add auto reconnect (#30)

pull/32/head
Aldino Kemal 3 years ago
committed by GitHub
parent
commit
cbf9e76f7b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/cmd/root.go

7
src/cmd/root.go

@ -17,8 +17,10 @@ import (
"github.com/markbates/pkger" "github.com/markbates/pkger"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
"log" "log"
"net/http"
"os" "os"
"strings" "strings"
"time"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -108,6 +110,11 @@ func runRest(cmd *cobra.Command, args []string) {
}) })
}) })
// Set auto reconnect to whatsapp server after booting
go func() {
time.Sleep(2 * time.Second)
_, _ = http.Get(fmt.Sprintf("http://localhost:%s/app/reconnect", config.AppPort))
}()
err = app.Listen(":" + config.AppPort) err = app.Listen(":" + config.AppPort)
if err != nil { if err != nil {
log.Fatalln("Failed to start: ", err.Error()) log.Fatalln("Failed to start: ", err.Error())

Loading…
Cancel
Save