Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- socket.event.message = { message in
- if let msgString = message as? String,
- let data = msgString.data(using: .utf8),
- let json = try! JSONSerialization.jsonObject(with: data) as? [String: Any],
- let type = json["type"] as? String
- {
- if type == "question"
- {
- print("Got a question!")
- print(json)
- }
- else if type == "broadcastEnded"
- {
- self.connectToHQSocket(url: url)
- }
- else
- {
- print(type)
- }
- }
- if let json = message as? [String: Any],
- let type = json["type"] as? String
- {
- print(type)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement