Comments (1)
After investigating this issue, It seems that the handshake request is being sent without the authorization header, which in the backend I am working with is required to establish the connection.
I tried to do something like this but still did not fix the issue
MessageHeaders headers = MessageHeaders();
headers.setHeaderValue(AuthInterceptor.authorizedHeader,
"Bearer ${GetIt.I<ShopperApiClient>().accessToken}");
HubConnection connection = HubConnectionBuilder()
.withUrl(
AppConfig.signalrUrl,
options: HttpConnectionOptions(
logger: transportProtLogger,
logMessageContent: !AppConfig.isProd,
headers: headers,
skipNegotiation: true,
requestTimeout: 120000,
transport: HttpTransportType.WebSockets,
accessTokenFactory: () async {
String accessToken = GetIt.I<ShopperApiClient>().accessToken;
return accessToken;
},
),
)
.withAutomaticReconnect(retryDelays: delaysInMilliSeconds)
.configureLogging(hubProtLogger)
.withHubProtocol(JsonHubProtocol())
.build();
return connection;
I have noticed that the first request and the negotiation both have the access token in their headers, just the handshake request does not have it and this causes the error "The underlying connection was closed before the hub handshake could complete."
from signalr_core.
Related Issues (20)
- Upgrade http dependency HOT 5
- How to create builder with Header?
- Exception: The underlying connection was closed before the hub handshake could complete. HOT 1
- BadState: Future already completed after calling _stopConnection
- signalr_core 1.1.1 depends on http ^0.13.0 HOT 2
- InvalidOperationException: Sequence contains no matching element HOT 1
- Unhandled Exception: Exception: HttpConnection.stopConnection(Exception: WebSocket closed with status code: 1002 (null).) was called while the connection is still in the connecting state. HOT 2
- signalr_core >=1.1.0 <1.1.2 depends on http ^0.13.0
- How to add proxy to HubConnectionBuilder?
- Retry lost connection forever?
- Server timeout after 30 seconds with long polling transport
- Stop method is not working
- Problem with HTTPS url HOT 4
- Please make this change in your code HOT 2
- Hubconnection.stop() take too long time
- Run signalR in background native service (Java et Kt)
- What is the proper way to subscribe on the events in SignalR?
- Future Plans HOT 8
- JavaScript error on laptop sleep only in release web build HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from signalr_core.