| 110 | } |
| 111 | |
| 112 | func (p *plexConnector) websocketDial() (*websocket.Conn, error) { |
| 113 | u := strings.TrimRight(strings.Replace(strings.Replace( |
| 114 | p.url.String(), "http://", "ws://", 1), "https://", "wss://", 1), "/") |
| 115 | url := fmt.Sprintf(defPlexNotificationURL, u, p.token) |
| 116 | |
| 117 | config, err := websocket.NewConfig(url, "http://localhost") |
| 118 | if err != nil { |
| 119 | return nil, err |
| 120 | } |
| 121 | if p.insecure { |
| 122 | config.TlsConfig = &tls.Config{InsecureSkipVerify: true} |
| 123 | } |
| 124 | return websocket.DialConfig(config) |
| 125 | } |
| 126 | |
| 127 | func (p *plexConnector) listenWebsocket() { |
| 128 | p.runningMu.Lock() |