I got HTTP 200 in handshake instead of HTTP 101. I use this SignalR client library mandrewcito/signalrcore. My API is hosted on IIS over SSL (TLS 1.2).
CODE
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()
HEADERS
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 - -----------------------
"Handshake status 200 OK" is when they use wrong transport type. "Handshake status 404 Not found" is when websockets communication is not allowed on server side.
I have to turn on websockets feature in IIS because this library support only websockets transport type.