Copied to clipboard

Flag this post as spam?

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


  • Lasse 49 posts 161 karma points
    May 07, 2019 @ 09:10
    Lasse
    0

    Umbraco SignalR tutorial

    Is there a tutorial how to use / install signalr with umbraco

    i found this topic, but it is very old and the link is no longer working

  • Lasse 49 posts 161 karma points
    May 28, 2019 @ 08:23
    Lasse
    0

    No one knows? :\

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    May 28, 2019 @ 09:21
    Kevin Jump
    1

    Hi Lasse,

    i don't have a tutorial, but i do have a couple of projects using signalR

    uSync8- - uses signalR

    from a client side,

    you need to create a Hub https://github.com/KevinJump/uSync8/blob/master/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js

    This is fairly boilerplate, it might look a little odd compared to the standard SignalR setup, but this is because you can't guarantee you are the first to ask for the hub something else might have called it before you) -

    The only element that changes is the name of your signlarR hub. https://github.com/KevinJump/uSync8/blob/master/uSync8.BackOffice/App_Plugins/uSync8/uSyncHub.js#L47

    then in the angular controller(s) where you want to use SignalR you need to initialise the hub so you can see this at the end of the main uSync controller here : https://github.com/KevinJump/uSync8/blob/master/uSync8.BackOffice/App_Plugins/uSync8/settings/uSyncController.js#L199

    from the back end code you need to create a hub

    https://github.com/KevinJump/uSync8/blob/master/uSync8.BackOffice/Hubs/uSyncHub.cs

    Creating this class will make it appear in the Umbraco generated code at /umbraco/backoffice/signalr/hubs which is how you can then refrence it in code

    Hooking into SignalR can be done a number of ways, in the uSync example we use a simple wrapper class to send messages to the clients https://github.com/KevinJump/uSync8/blob/master/uSync8.BackOffice/Hubs/HubClientService.cs - and we call this from API controllers, etc as needed.

    hope this gives you some pointers.

  • Lasse 49 posts 161 karma points
    May 29, 2019 @ 06:03
    Lasse
    0

    Thanks for the reply, i finally got the basic chat program working (Y)

    how would you use signalr to check if data has changed. I don't have db connection but a json string giving me all data i need.

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    May 29, 2019 @ 09:10
    Kevin Jump
    0

    Hi

    depends a lot on the setup but - I would suspect you have something in the background (so server-side c#) looking for changes, and pushing that to your SignalR Clients when a change happens, they would then receive the message and act upon it.

  • Dave Pearcey 46 posts 178 karma points
    Aug 10, 2020 @ 14:22
    Dave Pearcey
    0

    I'm trying to make a chatroom myself, have you got an example of how you managed to achieve it?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies