DVLP / signalr-no-jquery

120 stars 77 forks source link

How do you reference /signalr/hubs? #12

Closed gtwilliams03 closed 7 years ago

gtwilliams03 commented 7 years ago

Using this in a React-Redux app and I can see my API responding to calls - but I cannot get the hubs responding. In other SignalR projects I have done, you have to include /signalr/hubs from the source to list out the available hubs. Do you know where you do this in this project? Sorry if this is a dumb question, I just can't figure out if I need to import it, and where.

I am also getting the strange long polling double url in the Opening long polling request logging line below.

[15:51:36 GMT-0400 (EDT)] SignalR: Auto detected cross domain url.
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: Client subscribed to hub 'myHub'.
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: Negotiating with 'https://api.mydomain.com/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A%22myhub%22%7D%5D'.
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: longPolling transport starting.
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: Opening long polling request to 'https://api.mydomain.comhttps://api.mydomain.com/signalr/connect?tran…6mkntq1AlEO1e4&connectionData=%5B%7B%22name%22%3A%22myhub%22%7D%5D'.
jQueryShim.js:76 POST https://api.mydomain.comhttps//api.mydomain.com/signalr/connect?trans…6mkntq1AlEO1e4&connectionData=%5B%7B%22name%22%3A%22myhub%22%7D%5D net::ERR_NAME_NOT_RESOLVED
ajax @ jQueryShim.js:76
ajax @ signalR.js:1167
poll @ signalR.js:2280
(anonymous) @ signalR.js:2406
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: longPolling transport failed to connect. Attempting to fall back.
signalR.js:92 [15:51:36 GMT-0400 (EDT)] SignalR: No fallback transports were selected.
HubTester.js:21 could not connect to myHub
gtwilliams03 commented 7 years ago

Actually, I am going to close this, since I think I have the same issue as #1. If I put this url (without the redundant url at the beginning, i.e., change:

https://api.mydomain.comhttps//api.mydomain.com/signalr/connect?transport=longPolling&clientProtocol=1.5&connectionToken=[TOKEN]&connectionData=%5B%7B%22name%22%3A%22myhub%22%7D%5D

to

https//api.mydomain.com/signalr/connect?transport=longPolling&clientProtocol=1.5&connectionToken=[TOKEN]&connectionData=%5B%7B%22name%22%3A%22myhub%22%7D%5D

and POST that to my server, it replies with some happy SignalR stuff:

{
  "C": "d-A0E73A60-B,1|C,0|D,2",
  "S": 1,
  "M": []
}

So now I need to figure out how to put this fix in as well.

gtwilliams03 commented 7 years ago

In case it helps, I also had the issue #1 and had to edit line 1274 of the signalR.js file in node-modules/signar-no-jquery from this:

                url = baseUrl + connection.url,

to this:

                url = baseUrl + connection.appRelativeUrl,
wallaceturner commented 4 years ago

@gtwilliams03 Sorry if this is a dumb question, I just can't figure out if I need to import it, and where.

did you end up getting the hubs to work? my call to createHubProxy does not contain my server methods