(u *url.URL, serverID, sessionID string)
| 305 | } |
| 306 | |
| 307 | func makeWebsocketURL(u *url.URL, serverID, sessionID string) *url.URL { |
| 308 | if u.Scheme == "https" { |
| 309 | u.Scheme = "wss" |
| 310 | } else { |
| 311 | u.Scheme = "ws" |
| 312 | } |
| 313 | |
| 314 | if _, _, err := net.SplitHostPort(u.Host); err != nil { |
| 315 | if u.Scheme == "wss" { |
| 316 | u.Host = net.JoinHostPort(u.Host, "443") |
| 317 | } else { |
| 318 | u.Host = net.JoinHostPort(u.Host, "80") |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | u.Path = path.Join(u.Path, serverID, sessionID, "websocket") |
| 323 | |
| 324 | return u |
| 325 | } |