jamiewest/signalr_core

Problem with HTTPS url

hasanozkaynak26 opened this issue · 4 comments

I'm working well with localhost applications, but when i connect to https url i gave error like this.

Here is log.
I/flutter (13925): Starting HubConnection.
I/flutter (13925): Starting connection with transfer format 'TransferFormat.text'.
I/flutter (13925): Sending negotiation request: https://url:2600/notify/negotiate.
I/flutter (13925): Selecting transport 'HttpTransportType.serverSentEvents'.
I/flutter (13925): (SSE transport) Connecting.
I/flutter (13925): SSE connected to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw&access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zeXN0ZW0iOiIxZDMyZGUwYi02MzQ5LTQzNGYtZmMxZi0wOGRhMTNlZjc0NjUiLCJuYW1laWQiOiIzNmYwYjcyOC01NjA4LTQ3MGItYjQ1ZS0zMWI1YjY4YTA0MTUiLCJuYmYiOjE2NTI0NDgzMjgsImV4cCI6MTY1NTA0MDMyOCwiaWF0IjoxNjUyNDQ4MzI4fQ.1nsEoT33fdsV00Mrukq963YGwGsgM4xUtH6CHS1oPKw
I/flutter (13925): The HttpConnection connected successfully.
I/flutter (13925): Sending handshake request.
I/flutter (13925): (SSE transport) sending data. String data of length '32'.
I/flutter (13925): (SSE transport) request complete. Response status: 200.
I/flutter (13925): Using HubProtocol 'json'.
I/flutter (13925): HttpConnection.stopConnection(Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw) called while in state ConnectionState.connected.
I/flutter (13925): Connection disconnected with error 'Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw'.
I/flutter (13925): HubConnection.connectionClosed(Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw) called while in state HubConnectionState.connecting.
I/flutter (13925): Hub handshake failed with error 'Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw' during start(). Stopping HubConnection.
I/flutter (13925): Call to HttpConnection.stop(Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw) ignored because the connection is already in the disconnected state.
I/flutter (13925): HubConnection failed to start successfully because of error '{Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw.toString()}'.
E/flutter (13925): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Exception: Failed to connect to https://url:2600/notify?id=UvR4grgdVXNVH0cd4-Wqzw
E/flutter (13925):

It is a bug. Write acces_token to url as query string.

HubConnectionBuilder()
.withUrl(
'https://xxx.abc.com/xHub?access_token=eyJhbGc.... like that..

the following line is giving an erorr.

accessTokenFactory: () async =>
"eyJhbGc....

It is a bug. Write acces_token to url as query string.

HubConnectionBuilder() .withUrl( 'https://xxx.abc.com/xHub?access_token=eyJhbGc.... like that..

the following line is giving an erorr.

accessTokenFactory: () async => "eyJhbGc....

Thank you very much. It is working now. Very appreciated.

@hasanozkaynak26 how do you pass the token? bcz i am getting the same error