遇到麻烦,当我从套接字服务器接收数据时,它的格式不正确,如何将其转换为格式正确的jSON结构,而没有等号和分号。
static let manager = SocketManager(socketURL:
URL(string:"https://myurl.com")!, config: [.log(false), .reconnects(true), .compress, .forcePolling(false), .forceNew(true), .connectParams(["token": "myToken"])])
static let socket = manager.socket(forNamespace: "/contacts")
//////////////
socket.on("connect") { (data, ack) in
socket.emit("data", data)
print(data)
}
socket.on("dataR") { (data, ack) in
print(data)
}
我从socket.io'print'收到的内容
[<__NSArrayM 0x6000020147b0>(
{
addresses = (
{
address = myAddress;
currencyCode = BTC;
id = 1;
type = wallet;
}
);
createdDate = "2019-02-06T21:04:13.469Z";
id = 31;
name = Let;
surname = Me;
}
期望获得格式正确的JSON结构以在更远的地方工作。阅读所有文档,但是我自己无法处理。