Saya mendapatkan HTTP 200 di handshake alih-alih HTTP 101. Saya menggunakan library klien SignalR ini mandrewcito/signalrcore. API saya di-host di IIS melalui SSL (TLS 1.2).

KODE

self.awakeHub = HubConnectionBuilder()\
    .with_url(self.configuration.ServiceBaseAddress + "/hubs/awake", options=
    {
        "verify_ssl": False,
        "skip_negotiation": False,
    })\
    .configure_logging(logging.DEBUG, socket_trace=True)\
    .with_automatic_reconnect({
        "type": "interval",
        "keep_alive_interval": 10,
        "intervals": [1, 3, 5, 6, 7, 87, 3]
    }).build()

self.awakeHub.on_open(lambda: print("connection opened and handshake received ready to send messages"))
self.awakeHub.on_close(lambda: print("connection closed"))
self.awakeHub.on_error(lambda data: print(f"An exception was thrown closed{data.error}"))

self.awakeHub.on("AwakeReceived_Group", lambda data: self.awakeReceived(data))

self.awakeHub.start()

HEADER

Upgrade: websocket
Host: ***********
Origin: http://........
Sec-WebSocket-Key: rYqQacwytXMJ2roFL6AgwQ==
Sec-WebSocket-Version: 13
Connection: upgrade

2020-11-16 20:47:57,432 - websocket - DEBUG - -----------------------
2020-11-16 20:47:57,432 - websocket - DEBUG - --- response header ---
2020-11-16 20:47:57,451 - websocket - DEBUG - HTTP/1.1 200 OK
2020-11-16 20:47:57,452 - websocket - DEBUG - Content-Length: 0
2020-11-16 20:47:57,453 - websocket - DEBUG - Content-Type: application/octet-stream
2020-11-16 20:47:57,453 - websocket - DEBUG - Server: Microsoft-IIS/8.5
2020-11-16 20:47:57,454 - websocket - DEBUG - X-Powered-By: ASP.NET
2020-11-16 20:47:57,454 - websocket - DEBUG - Date: Mon, 16 Nov 2020 19:47:56 GMT
2020-11-16 20:47:57,455 - websocket - DEBUG - -----------------------
0
Dawid Wekwejt 16 November 2020, 23:08

1 menjawab

Jawaban Terbaik

"Status jabat tangan 200 OK" adalah ketika mereka menggunakan jenis transportasi yang salah. "Status jabat tangan 404 Tidak ditemukan" adalah saat komunikasi soket web tidak diizinkan di sisi server.

Saya harus mengaktifkan fitur soket web di IIS karena perpustakaan ini hanya mendukung jenis transportasi soket web.

0
Dawid Wekwejt 19 November 2020, 18:00