dotnet / dotnet/aspnetcore

Connect through proxy to signalr HUB - nodejs

Open
#32,779 2 comments 0 reactions 0 assignees View on GitHub
api-suggestion area-signalr help wanted
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.