Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Amit 6 posts 76 karma points
    Aug 12, 2021 @ 16:29
    Amit
    0

    SignalR package (Microsoft.AspNet.SignalR) not working on Umbraco Cloud (Error WebSocket connection failed)

    I have used SignalR package (Microsoft.AspNet.SignalR) in the project for real time messages, and it is working fine at local end on IIS and IIS Express but after deployed on umbraco cloud its not working. Here is the error: WebSocket connection to 'wss://example.com failed.(Websocket failed to connect.) After searching on the internet I found there is setting on the IIS for web socket, that should be enable.

    Umbrco cloud said SignalR not supported but Websocket supported on Umbraco cloud.

    But in my case it is throwing error on browser console (Websocket connection faild)

    Any suggestion what should I do on umbraco cloud?

  • Amit 6 posts 76 karma points
    Aug 16, 2021 @ 18:12
    Amit
    0

    Any one has faced this issue before or any idea?

    Thanks.

  • Amit 6 posts 76 karma points
    Aug 23, 2021 @ 08:02
    Amit
    0

    I have solved the issue with hub connection. Actually it was disconnected automatically. So I added code:

    $.connection.hub.disconnected(function () {
    setTimeout(function () { $.connection.hub.start(); }, 5000); });

    Now connection is creating but it is taking 30 to 50 seconds to create the connection. It is too long.

    If any suggestion to reduce the connection creating time, please suggest.

  • Amit 6 posts 76 karma points
    Aug 27, 2021 @ 17:03
    Amit
    0

    If we reduce timeout to 1 then it is connecting in 10 to 15 seconds. But it is still long time. This is only Umbraco cloud issue. SignalR working fine with all other live server (AWS, Godaddy, Local Server, Azure server).

    No one faced this issue before or not any help. I am trying to fix it myself.

  • Yuvraj Singh 32 posts 142 karma points
    Sep 03, 2021 @ 10:13
    Yuvraj Singh
    0

    $.connection.hub.start({ transport: "longPolling", function() { console.log('Connection hub started!'); } })

    (Error WebSocket connection failed) This issue will not come if you add -: transport: "longPolling"

  • Kevin Jump 2343 posts 14890 karma points MVP 8x c-trib
    Sep 03, 2021 @ 11:44
    Kevin Jump
    1

    Hi,

    there is quite a lot going on with SignalR on Umbraco cloud as a couple of the internal tools also use it (e.g Umbraco.Deploy).

    I have found you have to do things in a very specific order, and check to see other things haven't also started SignalR in your code

    the basics of this are in this repo: https://github.com/KevinJump/DoStuffWithUmbraco/blob/v8/Src/DoStuff.Core/App_Plugins/DoStuff.SignalR/signalRHub.js

    this has some of the check to see if its already there logic in it, which i think gets around most of the problems.

Please Sign in or register to post replies

Write your reply to:

Draft