SignalR and Realtime
No edit summary
No edit summary
Line 26: Line 26:
[https://<yoursiteurl>/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]
[https://<yoursiteurl>/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1]


[https://<yoursiteurl>/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1]
[https://yoursiteurl/signalr/start?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928728 https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1]


https://<yoursiteurl>/signalr/ping?_=1636029928729
https://<yoursiteurl>/signalr/ping?_=1636029928729


[https://<yoursiteurl>/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&]
[https://<yoursiteurl>/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&]

Revision as of 16:24, 4 November 2021

What is SignalR and what is it used for

SignalR is a .net software componenent used for Realtime communication. By realtime we mean that communication done point to point at the time of need.

How is realtime communication used in MDriven

We use the newly added realtime functionality in several ways.

  1. You can tag an attribute with "Realtime=true" , and systems that use WebApi communcations with an MDrivenServer will have the Attribute invalidated in a very short time after it was committed to the database. This functionality enables you to discover changes and react to them faster with less resource consumption than what you could before.
  2. MDrivenTurnkey - javascript client polled the server frequently to see if there where any updates to render, Now the client instead waits for an event from the server "WeGotNews" and then polls. Currently the client will still poll without this event - buut at a much lower frequency (68s instead of 8s)
  3. WPF Wecpof applications did not have the auto polling as Turnkey used - instead a refresh poll was done on ViewOpen. This has now changed and WPF-Wecpof also has the auto refresh. To avoid needing to do the refresh when nothing has changed - we have an AllIsWell-event sent from the MDrivenServer that also gives information on the sync-version-id - that the client can use to decide if a poll is needed or not.

Updates 2021 Feb

SignalR actually comes in 2 versions; one called SignalR and one SignalRCore. The 2 versions are not message compatible. The 2 versions can act as a client in both .net core and .net Framework(>4.6.1).

As we have the MDrivenServer- core version - and the built in in WPF Prototyper in MDrivenDesigner(.net Framework) - we have now added the capability to connect to a MDrivenServer-Core version from the MDrivenDesigner.

If you have Framework based clients you can also do so by adding the nuget package Microsoft.AspNetCore.SignalR.Client.

A framework based client that make use of the RealtimeStateSubscriberService will first try and connect to MDrivenServer Framework version with SignalR - if it fails it will then try and connect with SignalRCore.

The Turnkey Javascript client will also first try Framework communication and if failing to connect will switch to core communication.

Verify SignalR can connect (.net Framework)

If you are behind a reverse proxy and you have trouble to get SignalR to connect - then just try these calls in browser and make sure they are not blocked:

<yoursiteurl>/signalr/negotiate?clientProtocol=2.1&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&_=1636029928727 https://hkscratch.azurewebsites.net/signalr/negotiate?clientProtocol=2.1

<yoursiteurl>/signalr/connect?transport=serverSentEvents&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=5 https://hkscratch.azurewebsites.net/signalr/connect?transport=serverSentEvents&clientProtocol=2.1

https://hkscratch.azurewebsites.net/signalr/start?transport=serverSentEvents&clientProtocol=2.1

https://<yoursiteurl>/signalr/ping?_=1636029928729

<yoursiteurl>/signalr/reconnect?transport=serverSentEvents&messageId=d-3E0C687C-L%2C0%7CM%2C0%7CN%2C1&clientProtocol=2.1&connectionToken=zCSABES%2F94TT7OXHH9jrLt87wMItb0Ky6D3gZLYzeJTggqSTfVOS2xp87PfV%2Bo3XumUb0uqZvjtb5CMFWP%2FMGS9UtWl0SL1lKESfyWMe9y%2B2SMIl%2Fs%2BBz7zM4EoTF3Xj&connectionData=%5B%7B%22name%22%3A%22clientpushhub%22%7D%5D&tid=6 https://hkscratch.azurewebsites.net/signalr/reconnect?transport=serverSentEvents&

This page was edited 2 days ago on 03/26/2024. What links here