Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用Socket io连接iOS聊天应用程序中的服务器_Ios_Swift_Socket.io_Chat - Fatal编程技术网

无法使用Socket io连接iOS聊天应用程序中的服务器

无法使用Socket io连接iOS聊天应用程序中的服务器,ios,swift,socket.io,chat,Ios,Swift,Socket.io,Chat,我正在使用Socket.io进行swift应用程序 提到这个 它与localhost:3000完美配合,后者与节点JS一起构建 但不在mycustomurl:3002 还有一个调试发现,当我用php-S localhost:9000启动服务器时,服务器已经启动,但无法连接套接字。 我在调试区域也没有任何特定的消息 示例代码- static let shared = SocketHelper() private var manager: SocketManager? private var

我正在使用Socket.io进行swift应用程序

提到这个

它与
localhost:3000
完美配合,后者与节点JS一起构建

但不在
mycustomurl:3002
还有一个调试发现,当我用
php-S localhost:9000启动服务器时,服务器已经启动,但无法连接套接字。
我在调试区域也没有任何特定的消息

示例代码-

static let shared = SocketHelper()

private var manager: SocketManager?
private var socket: SocketIOClient?
private func configureSocketClient() {
    
    guard let url = URL(string: kHost) else {
        return
    }
    
    manager = SocketManager(socketURL: url, config: [.log(true), .compress])
    
    
    guard let manager = manager else {
        return
    }
    
    socket = manager.socket(forNamespace: "/**********")
}

func establishConnection() {
    
    guard let socket = manager?.defaultSocket else{
        return
    }
    
    socket.connect()
}
func sendMessage(message: String, withNickname nickname: String) {
    
    guard let socket = manager?.defaultSocket else {
        return
    }
    
    socket.emit("chatMessage", nickname, message)
}
我在用这个 对于
localhost
那么是否还需要一些后端集成?