Skip to content

Commit

Permalink
Fix Websocket issues (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomezve authored Feb 10, 2022
1 parent bf9fdc8 commit 8da6d2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apic/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"log"
"strings"

"github.com/gorilla/websocket"
)
Expand All @@ -17,7 +18,7 @@ type ApicWebSocket struct {
}

func NewApicWebSClient(ip string, token string) (*ApicWebSocket, error) {
u := fmt.Sprintf("wss://10.49.208.146/socket%s", token)
u := fmt.Sprintf("wss://%s/socket%s", strings.Replace(ip, "https://", "", -1), token)
d := *websocket.DefaultDialer
d.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
log.Printf("Setting up Websocket...")
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"aci-chatbot/bot"
"aci-chatbot/webex"
"errors"
"log"
"os"
)

Expand Down Expand Up @@ -60,7 +61,7 @@ func main() {
panic("Bot failed to start. Could not contact Webex API")
}
if err = b.SetupWebSocket(); err != nil {
panic("Bot failed to start. Error setting up the Websocket client")
log.Println("Bot failed to start. Error setting up the Websocket client")
}
if err = b.Start(":7001"); err != nil {
panic("Bot failed to start. Could not start HTTP Server")
Expand Down

0 comments on commit 8da6d2c

Please sign in to comment.