Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configurable http connection #63

Merged
merged 4 commits into from
Sep 18, 2021

Conversation

andig
Copy link
Contributor

@andig andig commented Sep 18, 2021

Fix #60

By passing e.g. an oauth2 client, the http connection connection can securely connect.

Example:

ctx := context.Background()
conn, err := signalr.NewHTTPConnection(ctx, "https://api.easee.cloud/hubs/chargers", signalr.HTTPClientOption(oauth2Client))
if err != nil {
	return c, err
}

client, err := signalr.NewClient(ctx, conn)
if err != nil {
	return c, err
}

I would also suggest to remove the NewHTTPClient as it has only limited flexibility (breaking change).

@andig andig marked this pull request as draft September 18, 2021 11:28
@andig andig marked this pull request as ready for review September 18, 2021 11:36
@andig andig marked this pull request as draft September 18, 2021 11:49
@philippseith philippseith marked this pull request as ready for review September 18, 2021 12:14
@philippseith
Copy link
Owner

Nice job! Could you please add a test for NewHTTPConnection?

@philippseith
Copy link
Owner

philippseith commented Sep 18, 2021

remove the NewHTTPClient:

As it is only used in tests, I don't bother :-)

@andig
Copy link
Contributor Author

andig commented Sep 18, 2021

remove the NewHTTPClient:

As it is only used in tests, I don't bother :-)

Maybe I'm doing this wrong- how would you connect to the API above instead?

@philippseith
Copy link
Owner

No, no, you are doing perfectly right. I meant removing the existing NewHTTPClient doesn't bother me.
When writing this package, my main objective was the server. But while writing it, I realised that there should be a simple go client to test the server. And it turned out that server client share a lot of code and are nearly interchangeable.

@andig
Copy link
Contributor Author

andig commented Sep 18, 2021

@philippseith do you want to start CI?

@andig
Copy link
Contributor Author

andig commented Sep 18, 2021

Tests are updated, too and http client removed

@philippseith philippseith merged commit 12ecf6e into philippseith:master Sep 18, 2021
@andig andig deleted the feature/http-connection branch September 19, 2021 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing client authentication
2 participants