swift – Why does not Starscream work on a real Apple Watch (WatchOS 6)?

Recently I upgraded my Apple Watch to WatchOS 6, my iPhone to iOS 13.1, Xcode to 11.1. MacOS still 10.14.6.

I've created an independent Apple Watch project in which I test the communication between Watch and a WebSocket server using Starscream: https://github.com/daltoniam/Starscream

It Works fine on the simulator but continue real Apple Watch When I try to connect to server I have these errors:

2019-10-08 18:57:53.064887+0200 BackgroundWebSocketOnlyWatch WatchKit Extension(251:31011) () nw_connection_get_connected_socket (C1) Client called nw_connection_get_connected_socket on unconnected nw_connection

2019-10-08 18:57:53.068928+0200 BackgroundWebSocketOnlyWatch WatchKit Extension(251:31011) TCP Conn 0x16d8d5f0 Failed : error 0:50 (50)

websocket is disconnected: Optional("The operation couldn’t be completed. Network is down")

I show you the code of my app:


import WatchKit
import Foundation
import Starscream

class InterfaceController: WKInterfaceController, WebSocketDelegate {

let socket = WebSocket(url: URL(string: "ws://echo.websocket.org/")!)

@IBOutlet var label: WKInterfaceLabel!


override func awake(withContext context: Any?) {
    super.awake(withContext: context)

    socket.delegate = self

override func willActivate() {
    // This method is called when watch view controller is about to be visible to user

override func didDeactivate() {
    // This method is called when watch view controller is no longer visible


@IBAction func connectButtonPressed() {


@IBAction func sendButtonPressed() {

    socket.write(string: "Hi!")

@IBAction func disconnectButtonPressed() {



func websocketDidConnect(socket: WebSocketClient) {
    print("websocket is connected")
func websocketDidDisconnect(socket: WebSocketClient, error: Error?) {
    print("websocket is disconnected: (error?.localizedDescription)")
func websocketDidReceiveMessage(socket: WebSocketClient, text: String) {
    print("got some text: (text)")
    label.setText("Received: (text)")

func websocketDidReceiveData(socket: WebSocketClient, data: Data) {
    print("got some data: (data.count)")

// Creates vibration
func createVibration() {

    print("Vibration created")


I tried with star scream With iOS 13.1 and it Works perfectly on simulator and real iPhone,

Is that a error from WatchOS 6 or does Starscream need an upgrade?

Thank you in advance! 🙂