Skip to content

Commit

Permalink
fix message sending
Browse files Browse the repository at this point in the history
  • Loading branch information
benlower committed Nov 14, 2024
1 parent d86c284 commit f873a22
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/Ultravox/Ultravox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,14 @@ private final class WebSocketConnection: NSObject, Sendable {
case let .data(messageData):
print("Unexpected data message")
return nil

Check warning on line 424 in Sources/Ultravox/Ultravox.swift

View workflow job for this annotation

GitHub Actions / check

Remove trailing space at end of a line. (trailingSpace)
case let .string(text):
guard let data = text.data(using: .utf8), let message = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { return nil }
guard message["type"] as? String == "room_info" else { return nil }
guard let roomInfo = message["room_info"] as? [String: Any] else { return nil }
guard let roomUrl = roomInfo["roomUrl"] as? String else { return nil }
guard let token = roomInfo["token"] as? String else { return nil }
guard let roomUrl = message["roomUrl"] as? String else { return nil }
guard let token = message["token"] as? String else { return nil }
return RoomInfoMessage(roomUrl: roomUrl, token: token)

Check warning on line 431 in Sources/Ultravox/Ultravox.swift

View workflow job for this annotation

GitHub Actions / check

Remove trailing space at end of a line. (trailingSpace)
@unknown default:
print("Unexpected message type")
return nil
Expand Down

0 comments on commit f873a22

Please sign in to comment.