Reputation: 21
I am making an app which uses the discord api. I have to use websockets to connect to the gateway but it always throws an error when I try to connect. I am using Starscream framework. Does anyone know how to fix this?
let socketHandler = SocketHandler(url: "wss://gateway.discord.gg/?v=6&encoding=json")
class SocketHandler: WebSocketDelegate {
var socket: WebSocket
func didReceive(event: WebSocketEvent, client: WebSocket) {
print("received")
}
init(url: String) {
self.socket = WebSocket(request: URLRequest(url: URL(string: url)!))
self.socket.delegate = self
socket.connect();
}
}
2020-02-07 20:09:35.452134+0100 DisChat WatchKit Extension[247:10072] [BoringSSL] boringssl_context_handle_fatal_alert(1872) [C1.1:1][0x1451d7f0] write alert, level: fatal, description: certificate unknown
2020-02-07 20:09:35.452923+0100 DisChat WatchKit Extension[247:10072] [BoringSSL] boringssl_context_error_print(1862) boringssl ctx 0x145fa5a0: 361843784:error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-283.60.3/ssl/handshake.cc:369:
2020-02-07 20:09:35.458630+0100 DisChat WatchKit Extension[247:10072] [BoringSSL] boringssl_session_handshake_error_print(111) [C1.1:1][0x1451d7f0] 361843784:error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-283.60.3/ssl/handshake.cc:369:
2020-02-07 20:09:35.458713+0100 DisChat WatchKit Extension[247:10072] [BoringSSL] nw_protocol_boringssl_handshake_negotiate_proceed(726) [C1.1:1][0x1451d7f0] handshake failed at state 12288
wss://gateway.discord.gg/?v=6&encoding=json
2020-02-07 20:09:37.501177+0100 DisChat WatchKit Extension[247:10046] [BoringSSL] boringssl_context_handle_fatal_alert(1872) [C2.1:1][0x1453aab0] write alert, level: fatal, description: certificate unknown
2020-02-07 20:09:37.501307+0100 DisChat WatchKit Extension[247:10046] [BoringSSL] boringssl_context_error_print(1862) boringssl ctx 0x1453d6a0: 341008120:error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-283.60.3/ssl/handshake.cc:369:
2020-02-07 20:09:37.502026+0100 DisChat WatchKit Extension[247:10046] [BoringSSL] boringssl_session_handshake_error_print(111) [C2.1:1][0x1453aab0] 341008120:error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-283.60.3/ssl/handshake.cc:369:
2020-02-07 20:09:37.502050+0100 DisChat WatchKit Extension[247:10046] [BoringSSL] nw_protocol_boringssl_handshake_negotiate_proceed(726) [C2.1:1][0x1453aab0] handshake failed at state 12288
Upvotes: 1
Views: 1425
Reputation: 31
This issue was brought up to me recently. handshake.cc line 369 is an OCSP failure. This seems weird as OSCP shouldn't be required. After some careful googling, I found this post which sounded like the same problem:
It looks like OCSP is enabled by default in starscream 4.0. Passing a nil as the ocspChecker appears to be the solution.
WebSocket(request: urlRequest, certPinner: nil)
Upvotes: 1