Replies: 3 comments
-
I'm using verstion 3.1.4 of the @microsoft/signalr npm package. |
Beta Was this translation helpful? Give feedback.
-
There is no supported way to grab the selected transport type. If you enable logging you will see what transport is being used. Also, since it's javascript you can always just access any properties you want and find the transport through that. (Not supported so any property you access might change in future versions) |
Beta Was this translation helpful? Give feedback.
-
I do see the selected transport logged when enabling logging but only for log levels 0, 1 and 2. Those also log out more information than I need. Going the unsupported route, the only place I could find a reference to the selected transport was connection?.connection?.transport?.constructor?.name where connection is an instance of the HubConnectionBuilder. However, in a production build that variable is minified that name is lost (compiles to 'e'). Also, I was only able to access that property name when using require('@microsoft/signalr') syntax. When importing with "import from '..." syntax, those properties are not accessible and produce this error: "Property 'connection' is private and only accessible within class 'HubConnection'." Is there another location that currently exists even though it is unsupported? |
Beta Was this translation helpful? Give feedback.
-
How can I access the selected TransportType that SignalR has negotiated and chosen between the client and server (LongPolling/ServerSentEvents/WebSockets)? I have a need to log this out on the client (in the browser console).
Beta Was this translation helpful? Give feedback.
All reactions