mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-30 20:34:22 +01:00
14 lines
417 B
TypeScript
14 lines
417 B
TypeScript
export function getHostname(url: string): string {
|
|
// Check if the URL begins with "ws://" or "wss://"
|
|
if (url.startsWith("ws://")) {
|
|
// If it does, remove "ws://" from the URL
|
|
url = url.slice(5);
|
|
} else if (url.startsWith("wss://")) {
|
|
// If it begins with "wss://", remove "wss://" from the URL
|
|
url = url.slice(6);
|
|
}
|
|
|
|
// Return the resulting URL
|
|
return url;
|
|
}
|