I created a Blazor project in asp.net core 3.1 and added API support and now was in process of adding Websockets to it.
I followed this tutorial.
https://dotnetplaybook.com/which-is-best-websockets-or-signalr/
Although the websocket middleware and everyting works, the moment I integrated it into Blazor project I am having issues
Hello from 2nd Request Delegate - No WebSocket
WebSocketServerConnectionManager-> AddSocket: WebSocket added with ID: 18a403b3-cbab-4523-b25d-00cddd4f05d5
Receive->Text
Message: {"protocol":"blazorpack","version":1}
Unhandled exception. Receive->Close on: 18a403b3-cbab-4523-b25d-00cddd4f05d5
Managed Connections: 0
Newtonsoft.Json.JsonReaderException: Additional text encountered after finished reading JSON content: . Path '', line 1, position 37.
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
Apparently there seems to be a websocket connection made to the server (even though I did not do anything) as soon as I load the webpage by blazor itself.
The socket message being ==> {"protocol":"blazorpack","version":1}
Of course the code is not handling this format and hence the error (which can be fixed).
But I am curious about this automatic socket connection made to begin with. Anyone know more about the mystery in-built socket messages from Blazor template?