SignalR: getting error: WebSocket closed RRS feed

  • Question

  • I am working on project of Ionic with angular and AspNet with SignalR that have chat module. I use SignalR for Chat.It's working smoothly but some time i am getting error as per below screen shot and because of that it's get stop working at all. I have hosted my service on IIS and creating proxy and communicating with client and server. Here is sample

    (function () {
              .factory('SignalRFactory', SignalRFactory);
            SignalRFactory.$inject = ['$rootScope', 'Hub', 'ionicToast'];
            function SignalRFactory($rootScope, Hub, ionicToast) {
                var signalRLocal = this;
                var serverURL = 'URL/signalr';
                //Hub setup
                var hub = new Hub('CommunicationHub', {
                    rootPath: serverURL,
                    listeners: {
                        'send': function (data) {
                            console.log("send " + data);
                    errorHandler: function (error) {
                    //Here i am getting that websocket closed error
                signalRLocal.Connect = function (user) {
                    console.log("SignalR Connecting as :" + user.UserName);
                    hub.invoke('connect', user);
                return signalRLocal;

    Error: WebSocket closed.
    Stack trace:

    The connection to ws://******/signalr/signalr/connect?transport=webSockets&clientProtocol=1.5&connectionToken=g8vpRv9ncVDjPIYB9UuEpAAILEaOcTMTG9p46IA2kPZri5WrbSQhu6rN8%2FCqZ0ZTg8ybjlm%2FAgqXzOYP3QHq1uZOsKf15kxd4J5xWsuF%2Bld8lkqyjqL%2Fyimj9%2BPYT%2Btd&connectionData=%5B%7B%22name%22%3A%22communicationhub%22%7D%5D&tid=4

    was interrupted while the page was loading.

    I have hosted service on IIS.

    I also try with  "long Polling" as per below

    Hub.connection.start({ transport: 'longPolling' });

    But i don't want to use "long Polling" at all. So can someone help me to figure out this issue without use of 'long Polling'. Can someone tell me what configuration i have to do at client side or at IIS level.

    Friday, July 28, 2017 11:05 AM

All replies

  • Hi Sagar Hirapara,

    Here is the forum for Developing Universal Windows apps, and we are focusing on developing universal windows apps issue. Your issue is more relative to ASP.NET, I will offtopic this thread, you can ask this issue in the ASP.NET forum.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 31, 2017 6:14 AM