---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/31904#article
headline: "31904: Stream - WebSocket - Host Unreachable"
url: https://www.twilio.com/docs/api/errors/31904
inLanguage: en
dateModified: 2026-04-29T19:18:40.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 31904: Stream - WebSocket - Host Unreachable

Log Type: APPLICATION

Log Level: ERROR

## Description

Twilio returns this error when it cannot create the Media Streams WebSocket connection because the host in your Stream `url` is unreachable. Twilio connects to Media Streams over `wss`, and your WebSocket endpoint must be reachable from the public internet.

### Possible causes

* The Stream `url` points to the wrong hostname or IP address.
* The hostname resolves to a private or otherwise non-routable IP address.
* Your WebSocket server is down or no longer connected to the internet.
* A firewall rule blocks secure WebSocket traffic on TCP port 443 between Twilio and your WebSocket server.

### Possible solutions

* Confirm that the Stream `url` is correct and uses `wss`. Update the hostname or IP address if it does not resolve to the server that should receive the stream.
* Replace private, internal, or non-routable addresses with a publicly reachable endpoint.
* Verify that your WebSocket server is running and reachable from the public internet.
* Update your firewall rules to allow secure WebSocket connections on TCP port 443 from Twilio to your WebSocket server.

#### Additional resources

* [TwiML `<Stream>`](/docs/voice/twiml/stream)
* [Stream resource API reference](/docs/voice/api/stream-resource)
* [Media Streams Configuration](/docs/global-infrastructure/firewall-configurations/media-streams-configuration)
