Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR port requirement

I haven't found much discussion about this... Most signalr samples I have seen would send and receive via a designated port like 5000 or 8080 I have a need for chatting in my app. My asp.net backend site does more than just handling messages between users, so it doesn't make a difference for me to host another page for that in the site my iis. I understand the difference of having the signalr self-hosted or hosted normally in iis... If I have it hosted by iis, so my users will access the page normally without a port, would that make a difference? Is there something internal in signalr that is preferring the use of a port? What are the pros/cons of using ports with signalr?

like image 403
user1019042 Avatar asked May 19 '16 19:05

user1019042


People also ask

What protocol does SignalR use?

SignalR provides two built-in hub protocols: a text protocol based on JSON and a binary protocol based on MessagePack. MessagePack generally creates smaller messages compared to JSON. Older browsers must support XHR level 2 to provide MessagePack protocol support.

Does SignalR use HTTP?

SignalR includes automatic connection management, it provides the facility to broadcast messages to all connected clients or to a specific client. The connection between the client and server is persistent while in HTTP it isn't persistent.

Does SignalR require sticky session?

Sticky Sessions SignalR requires that all HTTP requests for a specific connection be handled by the same server process. When SignalR is running on a server farm (multiple servers), "sticky sessions" must be used. "Sticky sessions" are also called session affinity by some load balancers.


1 Answers

SignalR has no preference for a specific port. When no port in specified in the URL then the port is implied from the protocol, e.g. HTTP uses port 80 and HTTPS uses port 443. So there is no concept of SignalR without a port.

I would think that the main reason for using SignalR on a different port than the rest of your site is that you can host SignalR independently of your main site without any interference in URL's etc. On the other hand, using a non-standard port may give you problems with restrictive firewalls that only allows traffic on port 80 and 443 to pass. When using a different port for SignalR you also lose the ability to use relative URL's to specify the SignalR endpoint.

like image 136
Martin Liversage Avatar answered Sep 20 '22 13:09

Martin Liversage