dotnet/aspnetcore

Connect through proxy to signalr HUB - nodejs

Open

#32.779 geöffnet am 17. Mai 2021

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (10.653 Forks)batch import
api-suggestionarea-signalrhelp wanted

Repository-Metriken

Stars
 (37.933 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16T 9h) (258 gemergte PRs in 30 T)

Beschreibung

Trying to connect to SignalR Hub through the nodejs client via a Proxy. The connection doesn't work with a corporate proxy. What should I put in options(aka IHttpConnectionOptions) in my nodejs client to get it to work ?

const signalR = require('@microsoft/signalr'); var url = require('url'); var HttpsProxyAgent = require('https-proxy-agent'); var agent;

// HTTP/HTTPS proxy to connect to var proxy = process.env.http_proxy; if (proxy) { var options = url.parse(proxy); agent = new HttpsProxyAgent(options); } let options = { accessTokenFactory: pcsUtils.getJwtToken, Proxy: agent//???????????? } connection = new signalR.HubConnectionBuilder() .withUrl(hubUrl, options) .build(); It works without the proxy.

TIA,

Contributor Guide